🚧 Work on command
This commit is contained in:
parent
2fb1f346a9
commit
b1f1f77b17
2 changed files with 51 additions and 10 deletions
25
app/Models/Input.php
Normal file
25
app/Models/Input.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Exceptions\Quit;
|
||||
|
||||
class Input
|
||||
{
|
||||
public ?array $files;
|
||||
public ?string $url;
|
||||
|
||||
public function assertValid(): void
|
||||
{
|
||||
throw_if(
|
||||
empty($this->files) && empty($this->url),
|
||||
Quit::class,
|
||||
'Must have either a valid file or URL'
|
||||
);
|
||||
}
|
||||
|
||||
public function hasURL(): bool
|
||||
{
|
||||
return !empty($this->url);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue