1 | <?php |
||
27 | abstract class AbstractFinder implements FinderInterface |
||
28 | { |
||
29 | |||
30 | use ConfigTrait; |
||
31 | |||
32 | /** |
||
33 | * Findable collection that the Finder can iterate through to find a match. |
||
34 | * |
||
35 | * @since 0.1.0 |
||
36 | * |
||
37 | * @var FindableCollection |
||
38 | */ |
||
39 | protected $findables; |
||
40 | |||
41 | /** |
||
42 | * NullObject that is returned if the Finder could not find a match. |
||
43 | * |
||
44 | * @since 0.1.0 |
||
45 | * |
||
46 | * @var NullObject |
||
47 | */ |
||
48 | protected $nullObject; |
||
49 | |||
50 | /** |
||
51 | * Instantiate an AbstractFinder object. |
||
52 | * |
||
53 | * @since 0.1.0 |
||
54 | * |
||
55 | * @param ConfigInterface $config Configuration of the AbstractFinder. |
||
56 | * |
||
57 | * @throws FailedToProcessConfigException If the config could not be processed. |
||
58 | */ |
||
59 | 8 | public function __construct(ConfigInterface $config) |
|
66 | |||
67 | /** |
||
68 | * Register the Findables defined in the given configuration. |
||
69 | * |
||
70 | * @since 0.1.0 |
||
71 | * |
||
72 | * @param ConfigInterface $config Configuration to register the Findables from. |
||
73 | */ |
||
74 | 8 | public function registerFindables(ConfigInterface $config) |
|
80 | |||
81 | /** |
||
82 | * Register the NullObject defined in the given configuration. |
||
83 | * |
||
84 | * @since 0.1.0 |
||
85 | * |
||
86 | * @param ConfigInterface $config Configuration to register the NullObject from. |
||
87 | */ |
||
88 | 8 | public function registerNullObject(ConfigInterface $config) |
|
92 | |||
93 | /** |
||
94 | * Get the NullObject. |
||
95 | * |
||
96 | * @since 0.1.1 |
||
97 | * |
||
98 | * @return NullObject NullObject for the current Finder. |
||
99 | */ |
||
100 | 1 | public function getNullObject() |
|
106 | |||
107 | /** |
||
108 | * Get the config key for the Findables definitions. |
||
109 | * |
||
110 | * @since 0.1.0 |
||
111 | * |
||
112 | * @return string Config key use to define the Findables. |
||
113 | */ |
||
114 | protected function getFindablesConfigKey() |
||
118 | |||
119 | /** |
||
120 | * Get the config key for the NullObject definitions. |
||
121 | * |
||
122 | * @since 0.1.0 |
||
123 | * |
||
124 | * @return string Config key use to define the NullObject. |
||
125 | */ |
||
126 | 8 | protected function getNullObjectConfigKey() |
|
130 | |||
131 | /** |
||
132 | * Initialize the NullObject. |
||
133 | * |
||
134 | * @since 0.1.1 |
||
135 | * |
||
136 | * @param mixed $arguments Optional. Arguments to use. |
||
137 | */ |
||
138 | 1 | protected function initializeNullObject($arguments = null) |
|
142 | |||
143 | /** |
||
144 | * Initialize the Findables that can be iterated. |
||
145 | * |
||
146 | * @param mixed $arguments Optional. Arguments to use. |
||
147 | * |
||
148 | * @since 0.1.0 |
||
149 | * |
||
150 | */ |
||
151 | protected function initializeFindables($arguments = null) |
||
157 | |||
158 | /** |
||
159 | * Initialize a single findable by instantiating class name strings and calling closures. |
||
160 | * |
||
161 | * @since 0.1.0 |
||
162 | * |
||
163 | * @param mixed $findable Findable to instantiate. |
||
164 | * @param mixed $arguments Optional. Arguments to use. |
||
165 | * |
||
166 | * @return Findable Instantiated findable. |
||
167 | */ |
||
168 | 18 | protected function initializeFindable($findable, $arguments = null) |
|
172 | |||
173 | /** |
||
174 | * Maybe instantiate a Findable if it is not yet an object. |
||
175 | * |
||
176 | * @since 0.1.1 |
||
177 | * |
||
178 | * @param mixed $findable Findable to instantiate. |
||
179 | * @param mixed $arguments Optional. Arguments to use. |
||
180 | * |
||
181 | * @return Findable Instantiated findable. |
||
182 | * @throws FailedToInstantiateFindableException If the findable could not be instantiated. |
||
183 | */ |
||
184 | 18 | protected function maybeInstantiateFindable($findable, $arguments = null) |
|
205 | |||
206 | /** |
||
207 | * Instantiate a Findable from a string. |
||
208 | * |
||
209 | * @since 0.1.1 |
||
210 | * |
||
211 | * @param string $string String to use for instantiation. |
||
212 | * @param mixed $arguments Optional. Arguments to use for instantiation. |
||
213 | * |
||
214 | * @return mixed |
||
215 | */ |
||
216 | 8 | protected function instantiateFindableFromString($string, $arguments = null) |
|
220 | |||
221 | /** |
||
222 | * Instantiate a Findable from a callable. |
||
223 | * |
||
224 | * @since 0.1.1 |
||
225 | * |
||
226 | * @param callable $callable Callable to use for instantiation. |
||
227 | * @param mixed $arguments Optional. Arguments to use for instantiation. |
||
228 | * |
||
229 | * @return mixed |
||
230 | */ |
||
231 | protected function instantiateFindableFromCallable($callable, $arguments = null) |
||
235 | } |
||
236 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..