src/Config.php
public static function fromDirectory(string $directory, string $suffix = '.php'): ConfigInterface
    {
        $config = [];
        foreach (new \DirectoryIterator($directory) as $file) {
            if ($file->isDot()) {
                continue;
            }

            $suffixLen = strlen($suffix);
            if (! (substr($file->getFilename(), -$suffixLen) === $suffix)) {
                continue;
            }

            // get the file namespace like app.php will be app.
            $namespace = substr($file->getFilename(), 0, -($suffixLen));

            // create the file resolver so we can resolve the
            $config[$namespace] = new File($file->getPathname());
        }

        return new static($config);
    }
public static function fromDirectory(string $directory, string $suffix = '.php'): ConfigInterface
    {
        $config = [];
        foreach (new \DirectoryIterator($directory) as $file) {
            if ($file->isDot()) {
                continue;
            }

            $suffixLen = strlen($suffix);
            if (! (substr($file->getFilename(), -$suffixLen) === $suffix)) {
                continue;
            }

            // get the file namespace like app.php will be app.
            $namespace = substr($file->getFilename(), 0, -($suffixLen));

            // create the file resolver so we can resolve the
            $config[$namespace] = new File($file->getPathname());
        }

        return new static($config);
    }
public static function fromDirectory ( string $ directory , string $ suffix = '.php' ) : ConfigInterface { $ config = [ ] ; foreach ( new \ DirectoryIterator ( $ directory ) as $ file ) { if ( $ file -> isDot ( ) ) { continue ; } $ suffixLen = strlen ( $ suffix ) ; if ( ! ( substr ( $ file -> getFilename ( ) , - $ suffixLen ) === $ suffix ) ) { continue ; } // get the file namespace like app.php will be app. $ namespace = substr ( $ file -> getFilename ( ) , 0 , - ( $ suffixLen ) ) ; // create the file resolver so we can resolve the $ config [ $ namespace ] = new File ( $ file -> getPathname ( ) ) ; } return new static ( $ config ) ; }
Fetch the config from the directory

@param string $directory
@param string $suffix
@return ConfigInterface
Fetch the config from the directory