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