src/Factory.php
public function load($path, LocatorInterface $locator, array $loaders = [], array $config = [])
    {
        $resource = $locator->locate($path);

        if(count($loaders) < 1){
            $loaders = [
                new PhpLoader(),
                new JsonLoader()
            ];
        }

        foreach($loaders as $loader){
            if(pathinfo($resource->getPath(), PATHINFO_EXTENSION) !== $loader->getExtension()){
                continue;
            }

            $config = $loader->load($resource);
            break;
        }

        return $config;
    }
public function load($path, LocatorInterface $locator, array $loaders = [], array $config = [])
    {
        $resource = $locator->locate($path);

        if(count($loaders) < 1){
            $loaders = [
                new PhpLoader(),
                new JsonLoader()
            ];
        }

        foreach($loaders as $loader){
            if(pathinfo($resource->getPath(), PATHINFO_EXTENSION) !== $loader->getExtension()){
                continue;
            }

            $config = $loader->load($resource);
            break;
        }

        return $config;
    }
public function load ( $ path , LocatorInterface $ locator , array $ loaders = [ ] , array $ config = [ ] ) { $ resource = $ locator -> locate ( $ path ) ; if ( count ( $ loaders ) < 1 ) { $ loaders = [ new PhpLoader ( ) , new JsonLoader ( ) ] ; } foreach ( $ loaders as $ loader ) { if ( pathinfo ( $ resource -> getPath ( ) , PATHINFO_EXTENSION ) !== $ loader -> getExtension ( ) ) { continue ; } $ config = $ loader -> load ( $ resource ) ; break ; } return $ config ; }
Load configuration from locator
@param string $path Path to configuration, relative to configured locator repository path e.g. /config/config.php
@param LocatorInterface $locator
@param LoaderInterface[] $loaders If is empty, PhpLoader and JsonLoader is loading by default
@param array $config Default configuration, overwrite by found config
@return array
Load configuration from locator