Conditions | 6 |
Paths | 6 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
28 | public function resolve(Reference $reference, Application $application) |
||
29 | { |
||
30 | try { |
||
31 | return $application->make($reference->getId()); |
||
32 | } catch (BindingResolutionException $exception) { |
||
33 | switch (true) { |
||
34 | case $reference->throwExceptionOnInvalidBehaviour(): |
||
35 | throw new ServiceNotFoundException(sprintf('Could not find service "%s"', $reference->getId())); |
||
36 | |||
37 | case $reference->returnNullOnInvalidBehaviour(): |
||
38 | case $reference->ignoreOnInvalidBehaviour(): |
||
39 | default: |
||
40 | return null; |
||
41 | } |
||
42 | } catch (\Exception $exception) { |
||
43 | throw new Exception(sprintf('Could not resolve service "%s"', $reference->getId()), 0, $exception); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |