1 | <?php |
||
39 | abstract class DependencyResolver { |
||
40 | |||
41 | /** @var string */ |
||
42 | protected $definitionPrefix; |
||
43 | |||
44 | /** @var \Brickoo\Component\IoC\DIContainer */ |
||
45 | protected $diContainer; |
||
46 | |||
47 | /** |
||
48 | * Class constructor. |
||
49 | * @param \Brickoo\Component\IoC\DIContainer $diContainer |
||
50 | * @param string $dependencyPrefix |
||
51 | */ |
||
52 | 3 | public function __construct(DIContainer $diContainer, $dependencyPrefix = "@") { |
|
56 | |||
57 | /** |
||
58 | * Returns the DI container instance. |
||
59 | * @return \Brickoo\Component\IoC\DIContainer |
||
60 | */ |
||
61 | 1 | public function getDiContainer() { |
|
64 | |||
65 | /** |
||
66 | * Resolves a dependency definition. |
||
67 | * @param \Brickoo\Component\IoC\Definition\DependencyDefinition |
||
68 | * @throws \Brickoo\Component\IoC\Exception |
||
69 | * @return mixed the resolved definition result |
||
70 | */ |
||
71 | abstract public function resolve(DependencyDefinition $dependencyDefinition); |
||
72 | |||
73 | /** |
||
74 | * Collects the arguments from an argument definition. |
||
75 | * @param \Brickoo\Component\IoC\Definition\Container\ArgumentDefinitionContainer $argumentsContainer |
||
76 | * @return array the collected arguments |
||
77 | */ |
||
78 | 2 | protected function collectArguments(ArgumentDefinitionContainer $argumentsContainer) { |
|
91 | |||
92 | /** |
||
93 | * Returns the argument index. |
||
94 | * @param \Brickoo\Component\IoC\Definition\ArgumentDefinition $argument |
||
95 | * @param integer $currentIndex |
||
96 | * @return string|integer the argument index |
||
97 | */ |
||
98 | 1 | private function getArgumentIndex(ArgumentDefinition $argument, $currentIndex) { |
|
101 | |||
102 | /** |
||
103 | * Returns the argument definition resolved value. |
||
104 | * @param \Brickoo\Component\IoC\Definition\ArgumentDefinition $argument |
||
105 | * @return mixed the argument value |
||
106 | */ |
||
107 | 1 | private function getArgumentValue(ArgumentDefinition $argument) { |
|
123 | |||
124 | /** |
||
125 | * Injects the target object dependencies. |
||
126 | * @param object $targetObject |
||
127 | * @param \Brickoo\Component\IoC\Definition\DependencyDefinition $dependencyDefinition |
||
128 | * @return \Brickoo\Component\IoC\Resolver\DependencyResolver |
||
129 | */ |
||
130 | 2 | protected function injectDependencies($targetObject, DependencyDefinition $dependencyDefinition) { |
|
146 | |||
147 | /** |
||
148 | * Injects the dependencies to the corresponding properties. |
||
149 | * @param object $targetObject |
||
150 | * @param array $injectionDefinitions |
||
151 | * @return void |
||
152 | */ |
||
153 | 1 | private function injectDependenciesToProperties($targetObject, array $injectionDefinitions) { |
|
161 | |||
162 | /** |
||
163 | * Injects the dependencies to the corresponding methods. |
||
164 | * @param object $targetObject |
||
165 | * @param array $injectionDefinitions |
||
166 | * @return void |
||
167 | */ |
||
168 | 1 | private function injectDependenciesToMethods($targetObject, array $injectionDefinitions) { |
|
176 | |||
177 | } |
||
178 |