Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
34 | 5 | private static function getAnnotation(string $key): string |
|
35 | { |
||
36 | 5 | $classReflection = new ReflectionClass(static::class); |
|
37 | 5 | foreach (static::getInheritance($classReflection, true) as $curClass) { |
|
38 | 5 | if (!($docComment = $curClass->getDocComment())) { |
|
39 | 5 | continue; |
|
40 | } |
||
41 | 5 | preg_match("#@$key\((?<$key>\w+)#", $docComment, $matches); |
|
42 | 5 | if (isset($matches[$key])) { |
|
43 | 5 | return trim($matches[$key]); |
|
44 | } |
||
45 | } |
||
46 | |||
47 | throw new InvalidArgumentException(sprintf("Missing @%s annotation on '%s'.", $key, static::class)); |
||
48 | } |
||
50 |