src/Factory.php
public static function fromFile(string $file, string $driver = null) : ConfigInterface
    {
        if (!$driver) {
            $ext = strtolower((string) pathinfo($file, PATHINFO_EXTENSION));
            /**
             * extension yml is also known as .yaml also
             * @link https://en.wikipedia.org/wiki/YAML
             */
            if ($ext === 'yml') {
                $ext = ConfigAdapterInterface::ADAPTER_YAML;
            }

            $driver = isset(static::$availableAdapter[$ext])
                ? static::$availableAdapter[$ext]
                : static::$availableAdapter[static::DEFAULT_ADAPTER];
        }

        if (! is_subclass_of($driver, ConfigAdapterInterface::class)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Config Driver invalid. Driver %s must be implement interface %s',
                    $driver,
                    ConfigAdapterInterface::class
                ),
                E_WARNING
            );
        }

        /**
         * @var ConfigAdapterInterface $driver
         */
        return $driver::fromFile($file);
    }
public static function fromFile(string $file, string $driver = null) : ConfigInterface
    {
        if (!$driver) {
            $ext = strtolower((string) pathinfo($file, PATHINFO_EXTENSION));
            /**
             * extension yml is also known as .yaml also
             * @link https://en.wikipedia.org/wiki/YAML
             */
            if ($ext === 'yml') {
                $ext = ConfigAdapterInterface::ADAPTER_YAML;
            }

            $driver = isset(static::$availableAdapter[$ext])
                ? static::$availableAdapter[$ext]
                : static::$availableAdapter[static::DEFAULT_ADAPTER];
        }

        if (! is_subclass_of($driver, ConfigAdapterInterface::class)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Config Driver invalid. Driver %s must be implement interface %s',
                    $driver,
                    ConfigAdapterInterface::class
                ),
                E_WARNING
            );
        }

        /**
         * @var ConfigAdapterInterface $driver
         */
        return $driver::fromFile($file);
    }
public static function fromFile ( string $ file , string $ driver = null ) : ConfigInterface { if ( ! $ driver ) { $ ext = strtolower ( ( string ) pathinfo ( $ file , PATHINFO_EXTENSION ) ) ; /**
             * extension yml is also known as .yaml also
             * @link https://en.wikipedia.org/wiki/YAML
             */ if ( $ ext === 'yml' ) { $ ext = ConfigAdapterInterface :: ADAPTER_YAML ; } $ driver = isset ( static :: $ availableAdapter [ $ ext ] ) ? static :: $ availableAdapter [ $ ext ] : static :: $ availableAdapter [ static :: DEFAULT_ADAPTER ] ; } if ( ! is_subclass_of ( $ driver , ConfigAdapterInterface :: class ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Config Driver invalid. Driver %s must be implement interface %s' , $ driver , ConfigAdapterInterface :: class ) , E_WARNING ) ; } /**
         * @var ConfigAdapterInterface $driver
         */ return $ driver :: fromFile ( $ file ) ; }
Get from file

@param string $file
@param string|null $driver

@return ConfigInterface
Get from file