1 | <?php |
||
20 | class Container implements ContainerInterface |
||
21 | { |
||
22 | /** @var array[string] Collection of loaded services */ |
||
23 | protected $services = array(); |
||
24 | |||
25 | /** @var array[string] Collection of alias => class name for alias resolving*/ |
||
26 | protected $aliases = array(); |
||
27 | |||
28 | 1 | protected function getClassName(\ReflectionParameter $param) { |
|
32 | |||
33 | /** |
||
34 | * Recursively build class constructor dependencies tree. |
||
35 | * |
||
36 | * @param string $className Current class name for analyzing |
||
37 | * @param array $dependencies Reference to tree for filling up |
||
38 | * |
||
39 | * @return array[string] Multidimensional array as dependency tree |
||
|
|||
40 | */ |
||
41 | 1 | protected function buildDependenciesTree($className, array &$dependencies = array()) |
|
76 | |||
77 | /** |
||
78 | * Finds an entry of the container by its identifier and returns it. |
||
79 | * |
||
80 | * @param string $id Identifier of the entry to look for. |
||
81 | * |
||
82 | * @throws NotFoundException No entry was found for this identifier. |
||
83 | * @throws ContainerException Error while retrieving the entry. |
||
84 | * |
||
85 | * @return mixed Entry. |
||
86 | */ |
||
87 | public function get($id) |
||
102 | |||
103 | /** |
||
104 | * Returns true if the container can return an entry for the given identifier. |
||
105 | * Returns false otherwise. |
||
106 | * |
||
107 | * @param string $id Identifier of the entry to look for. |
||
108 | * |
||
109 | * @return boolean |
||
110 | */ |
||
111 | public function has($id) |
||
115 | |||
116 | /** |
||
117 | * Set dependency alias with callback function. |
||
118 | * |
||
119 | * @param callable $callable Callable to return dependency |
||
120 | * @param string $alias Dependency name |
||
121 | * |
||
122 | * @return self Chaining |
||
123 | */ |
||
124 | public function callback($callable, $alias = null) |
||
128 | |||
129 | /** |
||
130 | * Set service dependency. Upon first creation of this class instance |
||
131 | * it would be used everywhere where this dependency is needed. |
||
132 | * |
||
133 | * @param string $className Fully qualified class name |
||
134 | * @param string $alias Dependency name |
||
135 | * @param array $parameters Collection of parameters needed for dependency creation |
||
136 | * |
||
137 | * @return self Chaining |
||
138 | */ |
||
139 | public function service($className, $alias = null, array $parameters = array()) |
||
143 | |||
144 | /** |
||
145 | * Set service dependency by passing object instance. |
||
146 | * |
||
147 | * @param mixed $instance Instance that needs to be return by this dependency |
||
148 | * @param string $alias Dependency name |
||
149 | * @param array $parameters Collection of parameters needed for dependency creation |
||
150 | * |
||
151 | * @return self Chaining |
||
152 | */ |
||
153 | public function instance(&$instance, $alias = null, array $parameters = array()) |
||
158 | |||
159 | /** |
||
160 | * Set dependency. |
||
161 | * |
||
162 | * @param string $className Fully qualified class name |
||
163 | * @param string $alias Dependency name |
||
164 | * @param array $parameters Collection of parameters needed for dependency creation |
||
165 | * |
||
166 | * @return ContainerInterface Chaining |
||
167 | */ |
||
168 | 1 | public function set($className, $alias = null, array $parameters = array()) |
|
174 | } |
||
175 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.