| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 5 | private static function resolve(): array |
|
| 19 | 1 | { |
|
| 20 | $class = static::class; |
||
| 21 | $doc = (new \ReflectionClass($class))->getDocComment(); |
||
| 22 | 4 | if(false === $doc) { |
|
| 23 | 1 | throw PlatenumException::fromMissingDocblock($class); |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | if(\preg_match_all('~^\s+\*\s+@method\s+static\s+(?:self|static)\s+(?<key>\w+)\(\)$~m', $doc, $matches) < 1) { |
|
| 27 | 3 | throw PlatenumException::fromEmptyDocblock($class); |
|
| 28 | 1 | } |
|
| 29 | if(\count($matches['key']) !== substr_count($doc, '@method')) { |
||
| 30 | throw PlatenumException::fromMalformedDocblock($class); |
||
| 31 | 2 | } |
|
| 32 | |||
| 33 | 2 | $values = []; |
|
| 34 | 2 | /** @var array<string,array<int,string>> $matches */ |
|
| 35 | foreach($matches['key'] as $key) { |
||
| 36 | $values[$key] = $key; |
||
| 37 | 2 | } |
|
| 38 | |||
| 39 | return $values; |
||
| 40 | } |
||
| 42 |