Conditions | 3 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
21 | function string_split(string $pattern, string $subject): array |
||
22 | { |
||
23 | 31 | $parts = preg_split($pattern, $subject, -1, \PREG_SPLIT_NO_EMPTY); |
|
24 | |||
25 | 31 | if (!\is_array($parts) || preg_last_error() !== \PREG_NO_ERROR) { |
|
26 | 1 | throw new \RuntimeException('Error splitting string'); |
|
27 | } |
||
28 | |||
29 | 30 | return $parts; |
|
30 | } |
||
31 |