Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3.0067 |
Changes | 3 | ||
Bugs | 1 | Features | 2 |
1 | <?php |
||
15 | 1 | public static function getAnnotations($class, $value) |
|
16 | { |
||
17 | 1 | $propertyReflect = new \ReflectionProperty($class, $value); |
|
18 | 1 | $doc = $propertyReflect->getDocComment(); |
|
19 | 1 | if (!preg_match_all('#@(.*?)\n#s', $doc, $annotations)) { |
|
20 | return false; |
||
21 | }; |
||
22 | 1 | $annotations = $annotations[1]; |
|
23 | 1 | $return = []; |
|
24 | 1 | foreach ($annotations as $annotation) { |
|
25 | 1 | list($k, $v) = array_pad(explode(' ', $annotation, 2), 2, null); |
|
26 | 1 | $return[$k] = $v; |
|
27 | } |
||
28 | |||
29 | 1 | return $return; |
|
30 | } |
||
31 | } |