1 | <?php |
||
15 | abstract class ClassDiscovery |
||
16 | { |
||
17 | /** |
||
18 | * A list of strategies to find classes. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | public static $strategies = [ |
||
23 | Strategy\Puli::class, |
||
24 | Strategy\HttpClients::class, |
||
25 | Strategy\GuzzleFactory::class, |
||
26 | Strategy\DiactorosFactory::class, |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Discovery cache to make the second time we use discovery faster. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | private static $cache = []; |
||
35 | |||
36 | /** |
||
37 | * Finds a class. |
||
38 | * |
||
39 | * @param string $type |
||
40 | * |
||
41 | * @return string |
||
42 | * |
||
43 | * @throws DiscoveryFailedException |
||
44 | */ |
||
45 | protected static function findOneByType($type) |
||
77 | |||
78 | /** |
||
79 | * Get a value from cache. |
||
80 | * |
||
81 | * @param string $type |
||
82 | * |
||
83 | * @return string|null |
||
84 | */ |
||
85 | private static function getFromCache($type) |
||
98 | |||
99 | /** |
||
100 | * Store a value in cache. |
||
101 | * |
||
102 | * @param string $type |
||
103 | * @param string $class |
||
104 | */ |
||
105 | private static function storeInCache($type, $class) |
||
109 | |||
110 | /** |
||
111 | * Clear the cache. |
||
112 | */ |
||
113 | public static function clearCache() |
||
117 | |||
118 | /** |
||
119 | * Evaulates conditions to boolean. |
||
120 | * |
||
121 | * @param mixed $condition |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | protected static function evaluateCondition($condition) |
||
147 | } |
||
148 |