public function getScope($scopeType, $scopeCode = null)
    {
        $scopeCode = $this->scopeCodeResolver->resolve($scopeType, $scopeCode);

        $code = $scopeType . '|' . $scopeCode;

        if (!isset($this->scopes[$code])) {
            $cacheKey = $this->cacheId . '|' . $code;
            $data     = $this->cache->load($cacheKey);

            if ($data) {
                $data = json_decode($data, true); // Enforce decoding JSON as associative array.
            } else {
                $reader = $this->readerPool->getReader($scopeType);
                $data   = ($scopeType === ScopeConfigInterface::SCOPE_TYPE_DEFAULT) ? $data = $reader->read() : $reader->read($scopeCode);

                $this->cache->save(json_encode($data), $cacheKey, [self::CACHE_TAG]);
            }

            $this->scopes[$code] = $this->dataFactory->create(['data' => (array) $data]);
        }

        return $this->scopes[$code];
    }
public function getScope($scopeType, $scopeCode = null)
    {
        $scopeCode = $this->scopeCodeResolver->resolve($scopeType, $scopeCode);

        $code = $scopeType . '|' . $scopeCode;

        if (!isset($this->scopes[$code])) {
            $cacheKey = $this->cacheId . '|' . $code;
            $data     = $this->cache->load($cacheKey);

            if ($data) {
                $data = json_decode($data, true); // Enforce decoding JSON as associative array.
            } else {
                $reader = $this->readerPool->getReader($scopeType);
                $data   = ($scopeType === ScopeConfigInterface::SCOPE_TYPE_DEFAULT) ? $data = $reader->read() : $reader->read($scopeCode);

                $this->cache->save(json_encode($data), $cacheKey, [self::CACHE_TAG]);
            }

            $this->scopes[$code] = $this->dataFactory->create(['data' => (array) $data]);
        }

        return $this->scopes[$code];
    }
public function getScope ( $ scopeType , $ scopeCode = null ) { $ scopeCode = $ this -> scopeCodeResolver -> resolve ( $ scopeType , $ scopeCode ) ; $ code = $ scopeType . '|' . $ scopeCode ; if ( ! isset ( $ this -> scopes [ $ code ] ) ) { $ cacheKey = $ this -> cacheId . '|' . $ code ; $ data = $ this -> cache -> load ( $ cacheKey ) ; if ( $ data ) { $ data = json_decode ( $ data , true ) ; // Enforce decoding JSON as associative array. } else { $ reader = $ this -> readerPool -> getReader ( $ scopeType ) ; $ data = ( $ scopeType === ScopeConfigInterface :: SCOPE_TYPE_DEFAULT ) ? $ data = $ reader -> read ( ) : $ reader -> read ( $ scopeCode ) ; $ this -> cache -> save ( json_encode ( $ data ) , $ cacheKey , [ self :: CACHE_TAG ] ) ; } $ this -> scopes [ $ code ] = $ this -> dataFactory -> create ( [ 'data' => ( array ) $ data ] ) ; } return $ this -> scopes [ $ code ] ; }
Retrieve config section

@SuppressWarnings(PHPMD.ElseExpression)

@param string                                    $scopeType Scope Type
@param string|\Magento\Framework\DataObject|null $scopeCode Scope Code

@return \Magento\Framework\App\Config\DataInterface
Retrieve config section