Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __construct($payload) |
||
17 | { |
||
18 | if (\is_string($payload)) { |
||
19 | $this->path = $payload; |
||
20 | } elseif (\is_array($payload)) { |
||
21 | $this->path = $payload['path'] ?? null; |
||
22 | $this->name = $payload['name'] ?? null; |
||
23 | } |
||
24 | |||
25 | if (!file_exists($this->path)) { |
||
26 | throw new FileNotFoundException($this->path); |
||
27 | } |
||
28 | |||
29 | $this->name = $this->name ?? basename($this->path); |
||
30 | } |
||
31 | |||
59 |