| Conditions | 4 |
| Paths | 4 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.024 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 13 | public function __call($method, $parameters = []) |
|
| 22 | { |
||
| 23 | 13 | if (isset($this->customServices[$method])) { |
|
| 24 | return $this->customServices[$method]; |
||
| 25 | } |
||
| 26 | |||
| 27 | 13 | $docBlockResolvable = DocBlockResolvable::fromCaller($this); |
|
| 28 | |||
| 29 | /** @var class-string $className */ |
||
| 30 | 13 | $className = $docBlockResolvable->getClassName($method); |
|
| 31 | 11 | $resolvableType = $docBlockResolvable->normalizeResolvableType($className); |
|
| 32 | |||
| 33 | 11 | $resolved = (new DocBlockServiceResolver($resolvableType)) |
|
| 34 | 11 | ->resolve($className); |
|
| 35 | |||
| 36 | 11 | if ($resolved !== null) { |
|
| 37 | 11 | return $resolved; |
|
| 38 | } |
||
| 39 | |||
| 40 | if ($docBlockResolvable->hasParentClass()) { |
||
| 41 | /** @psalm-suppress ParentNotFound, MixedAssignment, UndefinedMethod */ |
||
| 42 | $parentReturn = parent::__call($method, $parameters); // @phpstan-ignore-line |
||
| 43 | $this->customServices[$method] = $parentReturn; |
||
| 44 | |||
| 45 | return $parentReturn; |
||
| 46 | } |
||
| 47 | |||
| 48 | return null; |
||
| 49 | } |
||
| 51 |