Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
36 | 3 | protected function parseArray(string $values): array |
|
37 | { |
||
38 | // PostgreSql arrays represented as strings |
||
39 | // '{}' - empty array |
||
40 | // '{scope1}' or '{scope1,scope2}' - non-empty array |
||
41 | // so it should always start with '{' and end with '}'. |
||
42 | 3 | assert(substr($values, 0, 1) === '{' && substr($values, -1) === '}'); |
|
43 | |||
44 | 3 | $parsed = strlen($values) === 2 ? [] : explode(',', substr($values, 1, -1)); |
|
45 | |||
46 | 3 | return $parsed; |
|
47 | } |
||
48 | } |
||
49 |