33 lines
623 B
PHP
33 lines
623 B
PHP
<?php
|
|
|
|
namespace IO\Input;
|
|
|
|
use IO\Exception\MissingFileArgumentException;
|
|
use IO\Filesystem\File;
|
|
|
|
class ShowInfoArguments
|
|
{
|
|
use ArgvAccess;
|
|
|
|
private File $file;
|
|
|
|
public static function createFromGlobals(): self
|
|
{
|
|
$arguments = self::getScriptArgs();
|
|
return new self(array_shift($arguments));
|
|
}
|
|
|
|
public function __construct(?string $filepath)
|
|
{
|
|
if (is_null($filepath)) {
|
|
throw new MissingFileArgumentException();
|
|
}
|
|
$this->file = File::fromString($filepath);
|
|
}
|
|
|
|
public function getFile(): File
|
|
{
|
|
return $this->file;
|
|
}
|
|
}
|