1 | <?php |
||
23 | class DependencyResolver implements DependencyResolverInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var Mirror $mirror |
||
28 | */ |
||
29 | private $mirror; |
||
30 | |||
31 | /** |
||
32 | * @var ClassInterfaceCache $class_cache |
||
33 | */ |
||
34 | protected $class_cache; |
||
35 | |||
36 | /** |
||
37 | * @var EE_Dependency_Map $dependency_map |
||
38 | */ |
||
39 | private $dependency_map; |
||
40 | |||
41 | /** |
||
42 | * @var ClassAlias[] $aliases |
||
43 | */ |
||
44 | protected $aliases = array(); |
||
45 | |||
46 | /** |
||
47 | * @var array $namespace_roots |
||
48 | */ |
||
49 | protected $namespace_roots = array(); |
||
50 | |||
51 | |||
52 | /** |
||
53 | * RouteMatchSpecificationDependencyResolver constructor. |
||
54 | * |
||
55 | * @param Mirror $mirror |
||
56 | * @param ClassInterfaceCache $class_cache |
||
57 | * @param EE_Dependency_Map $dependency_map |
||
58 | */ |
||
59 | public function __construct( |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Used to configure and/or setup any aliases or namespace roots required by the DependencyResolver |
||
73 | * |
||
74 | * @throws InvalidAliasException |
||
75 | * @since 4.9.71.p |
||
76 | */ |
||
77 | public function initialize() |
||
81 | |||
82 | |||
83 | /** |
||
84 | * @return Mirror |
||
85 | */ |
||
86 | public function mirror() |
||
90 | |||
91 | /** |
||
92 | * @return ClassInterfaceCache |
||
93 | */ |
||
94 | public function classCache() |
||
98 | |||
99 | /** |
||
100 | * @return EE_Dependency_Map |
||
101 | */ |
||
102 | public function dependencyMap() |
||
106 | |||
107 | /** |
||
108 | * @param string $fqcn the class name that should be used (concrete class to replace interface) |
||
109 | * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
||
110 | * @param string $for_class the class that has the dependency (is type hinting for the interface) |
||
111 | * @throws InvalidAliasException |
||
112 | */ |
||
113 | public function addAlias($fqcn, $alias, $for_class = '') |
||
117 | |||
118 | /** |
||
119 | * @param string $param_fqcn Fully Qualified Class Name for dependency parameter |
||
120 | * @return string |
||
121 | */ |
||
122 | public function resolveAlias($param_fqcn) |
||
126 | |||
127 | /** |
||
128 | * Primarily used to indicate the namespace root for composite objects |
||
129 | * so that dependencies requiring the same DependencyResolver can be acquired |
||
130 | * for example: |
||
131 | * Vendor\path\to\class\A, Vendor\path\to\class\B, and Vendor\path\to\class\C |
||
132 | * may all implement Vendor\path\to\Interface, |
||
133 | * but Vendor\path\to\class\C could be a composite object |
||
134 | * that requires Vendor\path\to\class\A and Vendor\path\to\class\B, |
||
135 | * and needs both of those dependencies resolved, which would therefore require |
||
136 | * the use of the same DependencyResolver. |
||
137 | * |
||
138 | * By specifying a namespace root of "Vendor\path\to\", |
||
139 | * then all classes that are descendants of that namespace |
||
140 | * will use DependencyResolver to acquire the classes they need |
||
141 | * |
||
142 | * @param string $namespace_root Partial namespace used for detecting other classes |
||
143 | * that should employ this same DependencyResolver |
||
144 | */ |
||
145 | public function addNamespaceRoot($namespace_root) |
||
149 | |||
150 | /** |
||
151 | * Returns true if the parameter FQCN belongs to one of |
||
152 | * the namespaces that utilizes this DependencyResolver |
||
153 | * |
||
154 | * @param string $param_fqcn Fully Qualified Class Name for dependency parameter |
||
155 | * @return boolean |
||
156 | * @since 4.9.71.p |
||
157 | */ |
||
158 | public function dependencyRecursionExists($param_fqcn) |
||
167 | |||
168 | |||
169 | /** |
||
170 | * @param string $fqcn Fully Qualified Class Name |
||
171 | * @throws InvalidDataTypeException |
||
172 | * @throws ReflectionException |
||
173 | * @since 4.9.71.p |
||
174 | */ |
||
175 | public function resolveDependenciesForClass($fqcn) |
||
190 | } |
||
191 |