| Conditions | 5 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 7.3471 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 10 | public static function use(string|CustomExport|array $export): static |
|
| 15 | { |
||
| 16 | 10 | if (is_array($export)) { |
|
|
|
|||
| 17 | foreach ($export as $exportItem) { |
||
| 18 | static::use($exportItem); |
||
| 19 | } |
||
| 20 | |||
| 21 | return new static; |
||
| 22 | } |
||
| 23 | |||
| 24 | 10 | if (!is_string($export)) { |
|
| 25 | $export = $export::class; |
||
| 26 | } |
||
| 27 | |||
| 28 | 10 | if (!is_subclass_of($export, CustomExport::class)) { |
|
| 29 | throw new \Exception('Custom export should be subclass of ' . CustomExport::class); |
||
| 30 | } |
||
| 31 | |||
| 32 | 10 | static::$exports[] = $export; |
|
| 33 | |||
| 34 | 10 | return new static; |
|
| 35 | } |
||
| 68 |