1 | <?php |
||
23 | abstract class DependencyResolver implements DependencyResolverInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var Mirror $mirror |
||
28 | */ |
||
29 | private $mirror; |
||
30 | |||
31 | /** |
||
32 | * @var ClassInterfaceCache $class_cache |
||
33 | */ |
||
34 | private $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 | * @return Mirror |
||
72 | */ |
||
73 | public function mirror() |
||
77 | |||
78 | /** |
||
79 | * @return ClassInterfaceCache |
||
80 | */ |
||
81 | public function classCache() |
||
85 | |||
86 | /** |
||
87 | * @return EE_Dependency_Map |
||
88 | */ |
||
89 | public function dependencyMap() |
||
93 | |||
94 | /** |
||
95 | * @param ClassAlias $alias |
||
96 | * @throws InvalidAliasException |
||
97 | */ |
||
98 | public function addAlias(ClassAlias $alias) |
||
102 | |||
103 | /** |
||
104 | * @param string $param_fqcn Fully Qualified Class Name for dependency parameter |
||
105 | * @return string |
||
106 | */ |
||
107 | public function resolveAlias($param_fqcn) |
||
113 | |||
114 | /** |
||
115 | * Primarily used to indicate the namespace root for composite objects |
||
116 | * so that dependencies requiring the same DependencyResolver can be acquired |
||
117 | * for example: |
||
118 | * Vendor\path\to\class\A, Vendor\path\to\class\B, and Vendor\path\to\class\C |
||
119 | * may all implement Vendor\path\to\Interface, |
||
120 | * but Vendor\path\to\class\C could be a composite object |
||
121 | * that requires Vendor\path\to\class\A and Vendor\path\to\class\B, |
||
122 | * and needs both of those dependencies resolved, which would therefore require |
||
123 | * the use of the same DependencyResolver. |
||
124 | * |
||
125 | * By specifying a namespace root of "Vendor\path\to\", |
||
126 | * then all classes that are descendants of that namespace |
||
127 | * will use DependencyResolver to acquire the classes they need |
||
128 | * |
||
129 | * @param string $namespace_root Partial namespace used for detecting other classes |
||
130 | * that should employ this same DependencyResolver |
||
131 | */ |
||
132 | public function addNamespaceRoot($namespace_root) |
||
133 | { |
||
134 | $this->namespace_roots[] = $namespace_root; |
||
135 | } |
||
136 | |||
137 | /** |
||
138 | * Returns true if the parameter FQCN belongs to one of |
||
139 | * the namespaces that utilizes this DependencyResolver |
||
140 | * |
||
141 | * @param string $param_fqcn Fully Qualified Class Name for dependency parameter |
||
142 | * @return boolean |
||
143 | * @since $VID:$ |
||
144 | */ |
||
145 | public function dependencyRecursionExists($param_fqcn) |
||
154 | |||
155 | |||
156 | /** |
||
157 | * @param string $fqcn Fully Qualified Class Name |
||
158 | * @throws InvalidDataTypeException |
||
159 | * @throws ReflectionException |
||
160 | * @since $VID:$ |
||
161 | */ |
||
162 | public function resolveDependenciesForClass($fqcn) |
||
177 | } |
||
178 |