src/ResourceBuilder.php
public static function fromFile(string $file, string $locale): Resource
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException("$file is not a file");
        }
        
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        return static::fromString($contents, $locale);
    }
public static function fromFile(string $file, string $locale): Resource
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException("$file is not a file");
        }
        
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        return static::fromString($contents, $locale);
    }
public static function fromFile ( string $ file , string $ locale ) : Resource { if ( ! is_file ( $ file ) ) { throw new \ InvalidArgumentException ( "$file is not a file" ) ; } $ contents = file_get_contents ( $ file ) ; if ( $ contents === false ) { throw new \ RuntimeException ( "Error reading file at $file." ) ; } return static :: fromString ( $ contents , $ locale ) ; }
Creates a Resource from a file
@param string $file The path to the file
@param string $locale The locale
@return Resource
Creates a Resource from a file