_assertValidExtend example


        if (!isset($data[$section])) {
            throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
        }

        $thisSection  = $data[$section];

        if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) {
            if (is_array($thisSection[self::EXTENDS_NAME])) {
                throw new Zend_Config_Exception('Invalid extends clause: must be a string; array received');
            }
            $this->_assertValidExtend($section$thisSection[self::EXTENDS_NAME]);

            if (!$this->_skipExtends) {
                $config = $this->_processExtends($data$thisSection[self::EXTENDS_NAME]$config);
            }
            unset($thisSection[self::EXTENDS_NAME]);
        }

        $config = $this->_arrayMergeRecursive($config$thisSection);

        return $config;
    }

    

    protected function _processExtends(array $data$section, array $config = array())
    {
        if (!isset($data[$section])) {
            throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
        }

        $thisSection  = $data[$section];

        if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) {
            $this->_assertValidExtend($section$thisSection[self::EXTENDS_NAME]);

            if (!$this->_skipExtends) {
                $config = $this->_processExtends($data$thisSection[self::EXTENDS_NAME]$config);
            }
            unset($thisSection[self::EXTENDS_NAME]);
        }

        $config = $this->_arrayMergeRecursive($config$thisSection);

        return $config;
    }

    
protected function _processExtends(SimpleXMLElement $element$section, array $config = array())
    {
        if (!isset($element->$section)) {
            throw new Zend_Config_Exception("Section '$section' cannot be found");
        }

        $thisSection  = $element->$section;
        $nsAttributes = $thisSection->attributes(self::XML_NAMESPACE);

        if (isset($thisSection['extends']) || isset($nsAttributes['extends'])) {
            $extendedSection = (string) (isset($nsAttributes['extends']) ? $nsAttributes['extends'] : $thisSection['extends']);
            $this->_assertValidExtend($section$extendedSection);

            if (!$this->_skipExtends) {
                $config = $this->_processExtends($element$extendedSection$config);
            }
        }

        $config = $this->_arrayMergeRecursive($config$this->_toArray($thisSection));

        return $config;
    }

    

    protected function _processSection($iniArray$section$config = array())
    {
        $thisSection = $iniArray[$section];

        foreach ($thisSection as $key => $value) {
            if (strtolower($key) == ';extends') {
                if (isset($iniArray[$value])) {
                    $this->_assertValidExtend($section$value);

                    if (!$this->_skipExtends) {
                        $config = $this->_processSection($iniArray$value$config);
                    }
                } else {
                    /** * @see Zend_Config_Exception */
                    throw new Zend_Config_Exception("Parent section '$section' cannot be found");
                }
            } else {
                

    protected function _processSection($iniArray$section$config = [])
    {
        $thisSection = $iniArray[$section];

        foreach ($thisSection as $key => $value) {
            if (strtolower($key) === self::EXTENDS_MARKER) {
                if (isset($iniArray[$value])) {
                    $this->_assertValidExtend($section$value);

                    if (!$this->_skipExtends) {
                        $config = $this->_processSection($iniArray$value$config);
                    }
                } else {
                    throw new Enlight_Config_Exception(sprintf("Parent section '%s' cannot be found", $section));
                }
            } else {
                $config = $this->_processKey($config$key$value);
            }
        }

        

                if (\is_array($extendingSection) && $this->_sectionSeparator !== null) {
                    $extendingSection = implode($this->_sectionSeparator, $extendingSection);
                }
                if (\is_array($extendedSection) && $this->_sectionSeparator !== null) {
                    $extendedSection = implode($this->_sectionSeparator, $extendedSection);
                }
                $this->setExtend($extendingSection$extendedSection);
                $extendingSection = $extendedSection;
            }
        } else {
            $this->_assertValidExtend($this->_section, $extends);
            $this->setExtend($this->_section, $extends);
        }

        return $this;
    }

    /** * Returns the current config adapter. * * @return Enlight_Config_Adapter|null */
    
Home | Imprint | This part of the site doesn't use cookies.