| Total Complexity | 7 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class MethodService |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var ParameterService |
||
| 13 | */ |
||
| 14 | private $parameter; |
||
| 15 | |||
| 16 | 15 | public function __construct() |
|
| 17 | { |
||
| 18 | 15 | $this->parameter = new ParameterService(); |
|
| 19 | 15 | } |
|
| 20 | /** |
||
| 21 | * @param ReflectionMethod|null $method |
||
| 22 | * @return array<string> |
||
| 23 | */ |
||
| 24 | 9 | public function findDependencies(?ReflectionMethod $method): array |
|
| 25 | { |
||
| 26 | 9 | $parameters = []; |
|
| 27 | 9 | if ($method !== null) { |
|
| 28 | 6 | $parameters = $this->getDependencies($method); |
|
| 29 | } |
||
| 30 | 9 | return $parameters; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $comment |
||
| 35 | * @return array<string> |
||
| 36 | */ |
||
| 37 | 6 | private function getAnnotationParameters(string $comment): array |
|
| 38 | { |
||
| 39 | 6 | $result = []; |
|
| 40 | 6 | $matches = []; |
|
| 41 | 6 | preg_match_all("/@inject \\\\?([\w\d\\\\]*) \\$([\w\d]*)/", $comment, $matches, PREG_SET_ORDER); |
|
| 42 | 6 | foreach ($matches as $match) { |
|
| 43 | 3 | $result[$match[2]] = $match[1]; |
|
| 44 | } |
||
| 45 | 6 | return $result; |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param ReflectionMethod $method |
||
| 50 | * @return array<string> |
||
| 51 | */ |
||
| 52 | 6 | private function getDependencies(ReflectionMethod $method): array |
|
| 60 | } |
||
| 61 | } |
||
| 62 |