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 | 10 | ||
29 | /** |
||
30 | 10 | * 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 | 10 | */ |
|
45 | protected static function findOneByType($type) |
||
81 | |||
82 | 9 | /** |
|
83 | 9 | * Get a value from cache. |
|
84 | * |
||
85 | 9 | * @param string $type |
|
86 | * |
||
87 | * @return string|null |
||
88 | */ |
||
89 | private static function getFromCache($type) |
||
102 | 7 | ||
103 | 1 | /** |
|
104 | * Store a value in cache. |
||
105 | 1 | * |
|
106 | 1 | * @param string $type |
|
107 | * @param string $class |
||
108 | */ |
||
109 | private static function storeInCache($type, $class) |
||
113 | |||
114 | 1 | /** |
|
115 | * Evaulates conditions to boolean. |
||
116 | * |
||
117 | * @param mixed $condition |
||
118 | * |
||
119 | * @return bool |
||
120 | */ |
||
121 | protected static function evaluateCondition($condition) |
||
143 | } |
||
144 |