Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
41 | 11 | public static function init($strings) |
|
42 | { |
||
43 | 11 | if (is_null($strings)) { |
|
44 | 2 | return null; |
|
45 | } |
||
46 | |||
47 | 10 | if (self::isString($strings)) { |
|
48 | 3 | return new static([$strings]); |
|
49 | } |
||
50 | |||
51 | 8 | if (is_array($strings)) { |
|
52 | 7 | if (empty($strings)) { |
|
53 | 1 | return null; |
|
54 | } |
||
55 | |||
56 | 6 | return new self($strings); |
|
57 | } |
||
58 | |||
59 | 1 | throw new InvalidArgumentException('Argument must be string or string list ' . gettype($strings) . ' received'); |
|
60 | } |
||
61 | |||
77 |