public function load($resource, $type = null, $require = false)
    {
        if (null === $this->loader) {
            throw new LogicException('No loader has been configured.');
        }

        if (false === $this->loader->supports($resource, $type)) {
            throw LoaderException::format(
                'The resource "%s"%s is not supported by the loader.',
                is_scalar($resource) ? $resource : gettype($resource),
                $type ? " ($type)" : ''
            );
        }

        if ($this->cacheDir
            && $this->collector
            && is_string($resource)
            && (false === strpos("\n", $resource))
            && (false === strpos("\r", $resource))) {
            $cache = new ConfigCache(
                $this->cacheDir . DIRECTORY_SEPARATOR . basename($resource) . '.cache',
                $this->debug
            );

            if ($cache->isFresh()) {
                /** @noinspection PhpIncludeInspection */
                return require $cache;
            }
        }

        if ($this->collector) {
            $this->collector->clearResources();
        }

        $data = $this->process(
            $this->loader->load($resource, $type),
            $resource,
            $type,
            $require
        );

        if (isset($cache)) {
            $cache->write(
                '<?php return ' . var_export($data, true) . ';',
                $this->collector->getResources()
            );
        }

        return $data;
    }
public function load($resource, $type = null, $require = false)
    {
        if (null === $this->loader) {
            throw new LogicException('No loader has been configured.');
        }

        if (false === $this->loader->supports($resource, $type)) {
            throw LoaderException::format(
                'The resource "%s"%s is not supported by the loader.',
                is_scalar($resource) ? $resource : gettype($resource),
                $type ? " ($type)" : ''
            );
        }

        if ($this->cacheDir
            && $this->collector
            && is_string($resource)
            && (false === strpos("\n", $resource))
            && (false === strpos("\r", $resource))) {
            $cache = new ConfigCache(
                $this->cacheDir . DIRECTORY_SEPARATOR . basename($resource) . '.cache',
                $this->debug
            );

            if ($cache->isFresh()) {
                /** @noinspection PhpIncludeInspection */
                return require $cache;
            }
        }

        if ($this->collector) {
            $this->collector->clearResources();
        }

        $data = $this->process(
            $this->loader->load($resource, $type),
            $resource,
            $type,
            $require
        );

        if (isset($cache)) {
            $cache->write(
                '<?php return ' . var_export($data, true) . ';',
                $this->collector->getResources()
            );
        }

        return $data;
    }
public function load ( $ resource , $ type = null , $ require = false ) { if ( null === $ this -> loader ) { throw new LogicException ( 'No loader has been configured.' ) ; } if ( false === $ this -> loader -> supports ( $ resource , $ type ) ) { throw LoaderException :: format ( 'The resource "%s"%s is not supported by the loader.' , is_scalar ( $ resource ) ? $ resource : gettype ( $ resource ) , $ type ? " ($type)" : '' ) ; } if ( $ this -> cacheDir && $ this -> collector && is_string ( $ resource ) && ( false === strpos ( "\n" , $ resource ) ) && ( false === strpos ( "\r" , $ resource ) ) ) { $ cache = new ConfigCache ( $ this -> cacheDir . DIRECTORY_SEPARATOR . basename ( $ resource ) . '.cache' , $ this -> debug ) ; if ( $ cache -> isFresh ( ) ) { /** @noinspection PhpIncludeInspection */ return require $ cache ; } } if ( $ this -> collector ) { $ this -> collector -> clearResources ( ) ; } $ data = $ this -> process ( $ this -> loader -> load ( $ resource , $ type ) , $ resource , $ type , $ require ) ; if ( isset ( $ cache ) ) { $ cache -> write ( '<?php return ' . var_export ( $ data , true ) . ';' , $ this -> collector -> getResources ( ) ) ; } return $ data ; }
Loads the configuration data from a resource.

@param mixed   $resource A resource.
@param string  $type     The resource type.
@param boolean $require  Require processing?

@return array The data.

@throws LoaderException If the loader could not be used.
@throws LogicException  If no loader has been configured.
Loads the configuration data from a resource .