src/Mordilion/Configurable/Configuration/Factory.php
public static function fromFile(string $filename, ?string $identifier): Configuration
    {
        if ($identifier === null) {
            $pathinfo = pathinfo($filename);

            if (!isset($pathinfo['extension'])) {
                throw new \InvalidArgumentException('The filename "' . $filename . '" is missing an extension and cannot be auto-detected.');
            }

            $identifier = strtolower($pathinfo['extension']);
        }
        
        $reader = static::getReader($identifier);

        return new Configuration($reader->loadFile($filename));
    }
public static function fromFile(string $filename, ?string $identifier): Configuration
    {
        if ($identifier === null) {
            $pathinfo = pathinfo($filename);

            if (!isset($pathinfo['extension'])) {
                throw new \InvalidArgumentException('The filename "' . $filename . '" is missing an extension and cannot be auto-detected.');
            }

            $identifier = strtolower($pathinfo['extension']);
        }
        
        $reader = static::getReader($identifier);

        return new Configuration($reader->loadFile($filename));
    }
Creates a Configuration based on the file by the provided $filename.

@param string $filename
@param string|null $identifier

@throws \InvalidArgumentException if the provided filename i missing an extension

@return Configuration