1 | <?php |
||
16 | abstract class ClassDiscovery |
||
17 | { |
||
18 | /** |
||
19 | * A list of strategies to find classes. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | public static $strategies = [ |
||
24 | Strategy\Puli::class, |
||
25 | Strategy\HttpClients::class, |
||
26 | Strategy\GuzzleFactory::class, |
||
27 | Strategy\DiactorosFactory::class, |
||
28 | 10 | ]; |
|
29 | |||
30 | 10 | /** |
|
31 | * Discovery cache to make the second time we use discovery faster. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private static $cache = []; |
||
36 | |||
37 | /** |
||
38 | * Finds a class. |
||
39 | * |
||
40 | * @param $type |
||
41 | * |
||
42 | * @return string |
||
43 | * |
||
44 | 10 | * @throws DiscoveryFailedException |
|
45 | */ |
||
46 | public static function findOneByType($type) |
||
78 | 9 | ||
79 | 9 | /** |
|
80 | 9 | * Get a value from cache. |
|
81 | * |
||
82 | 9 | * @param string $type |
|
83 | 9 | * |
|
84 | * @return string|null |
||
85 | 9 | */ |
|
86 | private static function getFromCache($type) |
||
94 | |||
95 | /** |
||
96 | * Store a value in cache. |
||
97 | 8 | * |
|
98 | * @param string $type |
||
99 | 8 | * @param string $class |
|
100 | */ |
||
101 | 8 | private static function storeInCache($type, $class) |
|
105 | 1 | ||
106 | 1 | /** |
|
107 | * Evaulates conditions to boolean. |
||
108 | * |
||
109 | * @param mixed $condition |
||
110 | * |
||
111 | 7 | * @return bool |
|
112 | 1 | */ |
|
113 | protected static function evaluateCondition($condition) |
||
135 | } |
||
136 |