1 | <?php |
||
54 | class CallableMethodsList |
||
55 | { |
||
56 | // we are going to cache the results for performance |
||
57 | use StaticDataCache; |
||
58 | |||
59 | /** |
||
60 | * extract an indexed list of methods from an object |
||
61 | * |
||
62 | * @param object $obj |
||
63 | * the object to obtain method names from |
||
64 | * @return array |
||
65 | * a list of the matching method names, indexed by method name |
||
66 | * for quick look up |
||
67 | */ |
||
68 | public static function fromObject($obj) |
||
89 | |||
90 | /** |
||
91 | * extract an indexed list of methods from a class or object |
||
92 | * |
||
93 | * @param string $className |
||
94 | * the class to obtain method names from |
||
95 | * @return array |
||
96 | * a list of the matching method names, indexed by method name |
||
97 | * for quick look up |
||
98 | */ |
||
99 | protected static function fromClassName($className) |
||
120 | |||
121 | /** |
||
122 | * return a list of public methods on a class |
||
123 | * |
||
124 | * this will return both static and non-static methods |
||
125 | * |
||
126 | * @param string $className |
||
127 | * the class to check |
||
128 | * @return array |
||
129 | */ |
||
130 | private static function getPublicMethodsFromClass($className) |
||
136 | |||
137 | /** |
||
138 | * build a list of methods, based on whether they are static or not |
||
139 | * |
||
140 | * @param array $rawMethods |
||
141 | * a list of ReflectionMethod objects to filter on |
||
142 | * @param boolean $isStatic |
||
143 | * TRUE if you want only static methods |
||
144 | * FALSE if you want only non-static methods |
||
145 | * @return array |
||
146 | * the method names that have passed the filter |
||
147 | */ |
||
148 | private static function filterMethodsByStaticness($rawMethods, $isStatic) |
||
169 | |||
170 | /** |
||
171 | * extract an indexed list of methods from a class or object |
||
172 | * |
||
173 | * @param string $className |
||
174 | * the class to obtain method names from |
||
175 | * @return array |
||
176 | * a list of the matching method names, indexed by method name |
||
177 | * for quick look up |
||
178 | */ |
||
179 | public static function fromString($className) |
||
188 | |||
189 | /** |
||
190 | * extract an indexed list of methods from a class or object |
||
191 | * |
||
192 | * @param mixed $data |
||
193 | * the class or object to obtain method names from |
||
194 | * @return array |
||
195 | * a list of the matching method names, indexed by method name |
||
196 | * for quick look up |
||
197 | * |
||
198 | * @throws E4xx_UnsupportedType |
||
199 | */ |
||
200 | public static function from($data) |
||
216 | |||
217 | /** |
||
218 | * extract an indexed list of methods from a class or object |
||
219 | * |
||
220 | * @deprecated since 2.10.0 |
||
221 | * @codeCoverageIgnore |
||
222 | * @param mixed $data |
||
223 | * the class or object to obtain method names from |
||
224 | * @return array |
||
225 | * a list of the matching method names, indexed by method name |
||
226 | * for quick look up |
||
227 | * |
||
228 | * @throws E4xx_UnsupportedType |
||
229 | */ |
||
230 | public static function fromMixed($data) |
||
234 | |||
235 | /** |
||
236 | * extract an indexed list of methods from a class or object |
||
237 | * |
||
238 | * @param mixed $data |
||
239 | * the class or object to obtain method names from |
||
240 | * @return array |
||
241 | * a list of the matching method names, indexed by method name |
||
242 | * for quick look up |
||
243 | * |
||
244 | * @throws E4xx_UnsupportedType |
||
245 | */ |
||
246 | public function __invoke($data) |
||
250 | |||
251 | /** |
||
252 | * get the cache key to use for a given classname |
||
253 | * |
||
254 | * @param string $className |
||
255 | * the class we want to cache data about |
||
256 | * @return string |
||
257 | */ |
||
258 | private static function getClassCacheName($className) |
||
262 | |||
263 | /** |
||
264 | * get the cache key to use for a given object |
||
265 | * |
||
266 | * @param object $obj |
||
267 | * the object we want to cache data about |
||
268 | * @return string |
||
269 | */ |
||
270 | private static function getObjectCacheName($obj) |
||
274 | |||
275 | /** |
||
276 | * get cached data about a class |
||
277 | * |
||
278 | * @param string $className |
||
279 | * the class we want cached data for |
||
280 | * @return array|null |
||
281 | */ |
||
282 | private static function getClassFromCache($className) |
||
287 | |||
288 | /** |
||
289 | * write data about a class into our cache |
||
290 | * |
||
291 | * @param string $className |
||
292 | * the class we want to cache data for |
||
293 | * @param array $methodsList |
||
294 | * the data we want to cache |
||
295 | * @return void |
||
296 | */ |
||
297 | private static function setClassInCache($className, array $methodsList) |
||
302 | |||
303 | /** |
||
304 | * get cached data about an object |
||
305 | * |
||
306 | * @param object $obj |
||
307 | * the object we want cached data for |
||
308 | * @return array|null |
||
309 | */ |
||
310 | private static function getObjectFromCache($obj) |
||
315 | |||
316 | /** |
||
317 | * write data about an object into our cache |
||
318 | * |
||
319 | * @param object $obj |
||
320 | * the obj we want to cache data for |
||
321 | * @param array $methodsList |
||
322 | * the data we want to cache |
||
323 | * @return void |
||
324 | */ |
||
325 | private static function setObjectInCache($obj, array $methodsList) |
||
330 | |||
331 | /** |
||
332 | * return a list of methods that can be called on a class |
||
333 | * |
||
334 | * @param string $className |
||
335 | * the class to examine |
||
336 | * @return array |
||
337 | * a list of methods that can be called without having to |
||
338 | * instantiate an object |
||
339 | */ |
||
340 | private static function buildListOfClassMethods($className) |
||
353 | |||
354 | /** |
||
355 | * return a list of methods that can be called on an object |
||
356 | * |
||
357 | * @param object $obj |
||
358 | * the object to examine |
||
359 | * @return array |
||
360 | * a list of methods that can be called on the object |
||
361 | */ |
||
362 | private static function buildListOfObjectMethods($obj) |
||
375 | } |