Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
52 | public static function fromString(string $nameSectionItem) |
||
53 | { |
||
54 | $result = preg_match('/^([A-Z]+)\[(.*?)\]$/', $nameSectionItem, $matches); |
||
55 | if ($result !== 1) { |
||
56 | throw new \InvalidArgumentException('Not a name section item'); |
||
57 | } |
||
58 | |||
59 | return new self($matches[1], explode(' ', $matches[2])); |
||
60 | } |
||
61 | } |