1 | <?php |
||
16 | class ArgumentResolver |
||
17 | { |
||
18 | /** |
||
19 | * @var ArgumentDescriptor |
||
20 | */ |
||
21 | private $argumentDescriptor; |
||
22 | |||
23 | /** |
||
24 | * @var ConstraintResolver |
||
25 | */ |
||
26 | private $constraintResolver; |
||
27 | |||
28 | /** |
||
29 | * @param ArgumentDescriptor $argumentDescriptor |
||
30 | * @param ConstraintResolver $constraintResolver |
||
31 | */ |
||
32 | public function __construct(ArgumentDescriptor $argumentDescriptor, ConstraintResolver $constraintResolver) |
||
37 | |||
38 | /** |
||
39 | * Resolve the arguments needed by the given callable and the order of these |
||
40 | * arguments. |
||
41 | * |
||
42 | * It returns an array with the value of arguments in the right order. |
||
43 | * |
||
44 | * @param mixed $callable |
||
45 | * @param array $availableArguments |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | public function resolveArguments($callable, array $availableArguments = []) |
||
67 | |||
68 | /** |
||
69 | * @param ResolutionConstraintCollection $constraints |
||
70 | * @param ArgumentDescription $description |
||
71 | * @param array $availableArguments |
||
72 | * |
||
73 | * @return Resolution[] |
||
74 | */ |
||
75 | private function getArgumentResolutions(ResolutionConstraintCollection $constraints, ArgumentDescription $description, array $availableArguments) |
||
89 | |||
90 | /** |
||
91 | * @param ResolutionConstraintCollection $constraints |
||
92 | * @param ArgumentDescription $description |
||
93 | * @param string $argumentName |
||
94 | * @param mixed $argumentValue |
||
95 | * |
||
96 | * @return int |
||
97 | */ |
||
98 | private function getArgumentPriority(ResolutionConstraintCollection $constraints, ArgumentDescription $description, $argumentName, $argumentValue) |
||
122 | |||
123 | /** |
||
124 | * @param Resolutions $resolutions |
||
125 | * @param ArgumentDescriptions $descriptions |
||
126 | * |
||
127 | * @throws ResolutionException |
||
128 | */ |
||
129 | private function addMissingResolutions(Resolutions $resolutions, ArgumentDescriptions $descriptions) |
||
148 | } |
||
149 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: