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