src/Loaders/CoreConfigDataLoader.php
/**
     * Return's the Magento configuration value.
     *
     * @param string  $path    The Magento path of the requested configuration value
     * @param mixed   $default The default value that has to be returned, if the requested configuration value is not set
     * @param string  $scope   The scope the configuration value has been set
     * @param integer $scopeId The scope ID the configuration value has been set
     *
     * @return mixed The configuration value
     * @throws \Exception Is thrown, if nor a value can be found or a default value has been passed
     */
Return's the Magento configuration value.
@param string  $path    The Magento path of the requested configuration value
@param mixed   $default The default value that has to be returned, if the requested configuration value is not set
@param string  $scope   The scope the configuration value has been set
@param integer $scopeId The scope ID the configuration value has been set

@return mixed The configuration value
@throws \Exception Is thrown, if nor a value can be found or a default value has been passed
Return ' s the Magento configuration value . @param string $path The Magento path of the requested configuration value @param mixed $default The default value that has to be returned if the requested configuration value is not set @param string $scope The scope the configuration value has been set @param integer $scopeId The scope ID the configuration value has been set @return mixed The configuration value @throws \ Exception Is thrown if nor a value can be found or a default value has been passed
public function load($path = null, $default = null, $scope = ScopeKeys::SCOPE_DEFAULT, $scopeId = 0)
    {
        $coreConfigData = array(
            MemberNames::PATH => $path,
            MemberNames::SCOPE => $scope,
            MemberNames::SCOPE_ID => $scopeId
        );
        $uniqueIdentifier = $this->coreConfigDataUidGenerator->generate($coreConfigData);
        if (isset($this->coreConfigData[$uniqueIdentifier])) {
            return $this->coreConfigData[$uniqueIdentifier][MemberNames::VALUE];
        }
        if ($scope === ScopeKeys::SCOPE_STORES) {
            foreach ($this->storeWebsites as $storeWebsite) {
                if ($storeWebsite[MemberNames::WEBSITE_ID] === $scopeId) {
                    $coreConfigData = array_merge(
                        $coreConfigData,
                        array(
                            MemberNames::SCOPE    => ScopeKeys::SCOPE_WEBSITES,
                            MemberNames::SCOPE_ID => $storeWebsite[MemberNames::WEBSITE_ID]
                        )
                    );
                    , merged with the 'websites' scope and ID
                    $uniqueIdentifier = $this->coreConfigDataUidGenerator->generate($coreConfigData);
                    if (isset($this->coreConfigData[$uniqueIdentifier][MemberNames::VALUE])) {
                        return $this->coreConfigData[$uniqueIdentifier][MemberNames::VALUE];
                    }
                }
            }
        }
        $coreConfigData = array_merge(
            $coreConfigData,
            array(
                MemberNames::SCOPE    => ScopeKeys::SCOPE_DEFAULT,
                MemberNames::SCOPE_ID => 0
            )
        );
        , merged with the 'default' scope and ID 0
        $uniqueIdentifier = $this->coreConfigDataUidGenerator->generate($coreConfigData);
        if (isset($this->coreConfigData[$uniqueIdentifier][MemberNames::VALUE])) {
            return $this->coreConfigData[$uniqueIdentifier][MemberNames::VALUE];
        }
        if ($default !== null) {
            return $default;
        }
        throw new \Exception(
            sprintf(
                'Can\'t find a value for configuration "%s-%s-%d" in "core_config_data"',
                $path,
                $scope,
                $scopeId
            )
        );
    }
public function load ( $ path = null , $ default = null , $ scope = ScopeKeys :: SCOPE_DEFAULT , $ scopeId = 0 ) { $ coreConfigData = array ( MemberNames :: PATH => $ path , MemberNames :: SCOPE => $ scope , MemberNames :: SCOPE_ID => $ scopeId ) ; $ uniqueIdentifier = $ this -> coreConfigDataUidGenerator -> generate ( $ coreConfigData ) ; if ( isset ( $ this -> coreConfigData [ $ uniqueIdentifier ] ) ) { return $ this -> coreConfigData [ $ uniqueIdentifier ] [ MemberNames :: VALUE ] ; } if ( $ scope === ScopeKeys :: SCOPE_STORES ) { foreach ( $ this -> storeWebsites as $ storeWebsite ) { if ( $ storeWebsite [ MemberNames :: WEBSITE_ID ] === $ scopeId ) { $ coreConfigData = array_merge ( $ coreConfigData , array ( MemberNames :: SCOPE => ScopeKeys :: SCOPE_WEBSITES , MemberNames :: SCOPE_ID => $ storeWebsite [ MemberNames :: WEBSITE_ID ] ) ) ; $ uniqueIdentifier = $ this -> coreConfigDataUidGenerator -> generate ( $ coreConfigData ) ; if ( isset ( $ this -> coreConfigData [ $ uniqueIdentifier ] [ MemberNames :: VALUE ] ) ) { return $ this -> coreConfigData [ $ uniqueIdentifier ] [ MemberNames :: VALUE ] ; } } } } $ coreConfigData = array_merge ( $ coreConfigData , array ( MemberNames :: SCOPE => ScopeKeys :: SCOPE_DEFAULT , MemberNames :: SCOPE_ID => 0 ) ) ; $ uniqueIdentifier = $ this -> coreConfigDataUidGenerator -> generate ( $ coreConfigData ) ; if ( isset ( $ this -> coreConfigData [ $ uniqueIdentifier ] [ MemberNames :: VALUE ] ) ) { return $ this -> coreConfigData [ $ uniqueIdentifier ] [ MemberNames :: VALUE ] ; } if ( $ default !== null ) { return $ default ; } throw new \ Exception ( sprintf ( 'Can\'t find a value for configuration "%s-%s-%d" in "core_config_data"' , $ path , $ scope , $ scopeId ) ) ; }
Return's the Magento configuration value.
Return ' s the Magento configuration value .
// initialize the core config data // generate the UID from the passed data // iterate over the core config data and try to find the requested configuration value // query whether or not we've to query for the configuration value on fallback level 'websites' also // query whether or not the website with the passed ID is available // replace scope with 'websites' and website ID // generate the UID from the passed data, merged with the 'websites' scope and ID // query whether or not, the configuration value on 'websites' level // replace scope with 'default' and scope ID '0' // generate the UID from the passed data, merged with the 'default' scope and ID 0 // query whether or not, the configuration value on 'default' level // if not, return the passed default value // throw an exception if no value can be found // in the Magento configuration