Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 34 | public static function parse($def) |
|
37 | { |
||
38 | 34 | $type = new TypeDefinition; |
|
39 | |||
40 | 34 | preg_match(self::RE_PROPERTY, $def, $matches); |
|
41 | |||
42 | 34 | if (empty($matches[2])) { |
|
43 | 5 | throw new \LogicException(); |
|
44 | } |
||
45 | 29 | $type->is_nullable = !empty($matches[1]); |
|
|
|||
46 | 29 | $type->expected = $matches[2]; |
|
47 | 29 | $type->is_array = !empty($matches[3]); |
|
48 | 29 | if (isset($matches[4]) && is_numeric($matches[4])) { |
|
49 | 5 | $type->len = (int)$matches[4]; |
|
50 | } |
||
51 | |||
52 | 29 | return $type; |
|
53 | } |
||
68 |