| Conditions | 5 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5.0342 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 3 | public function __construct(mixed $data) |
|
| 27 | { |
||
| 28 | 3 | if ($data instanceof UploadedFileInterface) { |
|
| 29 | 1 | $this->data = [$data]; |
|
| 30 | 3 | } elseif (!is_array($data)) { |
|
| 31 | 2 | throw new InvalidArgumentException('Data should contain array of uploaded files'); |
|
| 32 | } else { |
||
| 33 | 3 | foreach ($data as $file) { |
|
| 34 | 2 | if (!$file instanceof UploadedFileInterface) { |
|
| 35 | throw new InvalidArgumentException('Data should contain UploadedFileInterface objects only'); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | /** @var UploadedFileInterface[] $data */ |
||
| 39 | 3 | $this->data = $data; |
|
| 40 | } |
||
| 43 |