1 | <?php |
||
27 | final class ServiceArgumentResolver implements ArgumentResolver |
||
28 | { |
||
29 | private $kernel; |
||
30 | |||
31 | /** |
||
32 | * Initializes resolver. |
||
33 | * |
||
34 | * @param KernelInterface $kernel |
||
35 | */ |
||
36 | public function __construct(KernelInterface $kernel) |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function resolveArguments(ReflectionClass $classReflection, array $arguments) |
||
54 | |||
55 | /** |
||
56 | * Resolves single argument using container. |
||
57 | * |
||
58 | * @param string $argument |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | private function resolveArgument($argument) |
||
86 | |||
87 | /** |
||
88 | * @param ContainerInterface $container |
||
89 | * @param string $argument |
||
90 | * @return object|null |
||
91 | * @throws ServiceNotFoundException |
||
92 | */ |
||
93 | private function getService(ContainerInterface $container, $argument) |
||
101 | |||
102 | /** |
||
103 | * @param string $argument |
||
104 | * @return string|null |
||
105 | */ |
||
106 | private function getServiceName($argument) |
||
114 | |||
115 | /** |
||
116 | * Sanitise the container key given by the Behat config file, |
||
117 | * and retrieve the parameter from the Container. |
||
118 | * |
||
119 | * First, check if the whole string is one substitution, if it is, then pull it from the container. |
||
120 | * |
||
121 | * Secondly, iterate over all substitutions in the string. Exception is thrown if referencing a |
||
122 | * collection-type parameter when the key is not an entire substitution. |
||
123 | * |
||
124 | * This is to handle the case where we're given an argument which should return a |
||
125 | * collection-type parameter from the container. |
||
126 | * |
||
127 | * @param ContainerInterface $container |
||
128 | * @param string $argument |
||
129 | * @throws InvalidArgumentException |
||
130 | * @return mixed |
||
131 | */ |
||
132 | private function replaceParameters(ContainerInterface $container, $argument) |
||
160 | |||
161 | /** |
||
162 | * @param string $argument |
||
163 | * @return string |
||
164 | */ |
||
165 | private function escape($argument) |
||
171 | } |
||
172 |