| Total Complexity | 6 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | * @author Filipe Silva <[email protected]> |
||
| 21 | */ |
||
| 22 | final readonly class ConstructorArgumentInspector |
||
|
|
|||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Creates a ConstructorArgumentInspector |
||
| 26 | * |
||
| 27 | * @param ReflectionClass $reflectionClass |
||
| 28 | * @param ContainerInterface $container |
||
| 29 | * @param array<string|int, mixed> $override |
||
| 30 | */ |
||
| 31 | public function __construct( |
||
| 32 | private ReflectionClass $reflectionClass, |
||
| 33 | private ContainerInterface $container, |
||
| 34 | private array $override = [] |
||
| 35 | ) { |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Returns the list of alias to used as arguments on object definition |
||
| 40 | * |
||
| 41 | * @return array |
||
| 42 | */ |
||
| 43 | public function arguments(): array |
||
| 44 | { |
||
| 45 | $method = $this->reflectionClass->getConstructor(); |
||
| 46 | if (!$method instanceof ReflectionMethod) { |
||
| 47 | return []; |
||
| 48 | } |
||
| 49 | |||
| 50 | return (new MethodArgumentInspector( |
||
| 51 | $method, |
||
| 52 | $this->container, |
||
| 53 | $this->override |
||
| 54 | ))->arguments(); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |