1 | <?php |
||
20 | abstract class ClassDiscovery |
||
21 | { |
||
22 | /** |
||
23 | * A list of strategies to find classes. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | public static $strategies = [ |
||
28 | 10 | Puli::class, |
|
29 | HttpClients::class, |
||
30 | 10 | GuzzleFactory::class, |
|
31 | DiactorosFactory::class, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Discovery cache to make the second time we use discovery faster. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | private static $cache = []; |
||
40 | |||
41 | /** |
||
42 | * Finds a class. |
||
43 | * |
||
44 | 10 | * @param $type |
|
45 | * |
||
46 | * @return string |
||
47 | * |
||
48 | * @throws NotFoundException |
||
49 | */ |
||
50 | public static function findOneByType($type) |
||
82 | 9 | ||
83 | 9 | /** |
|
84 | * Get a value from cache. |
||
85 | 9 | * |
|
86 | * @param string $type |
||
87 | * |
||
88 | * @return string|null |
||
89 | */ |
||
90 | private static function getFromCache($type) |
||
98 | |||
99 | 8 | /** |
|
100 | * Store a value in cache. |
||
101 | 8 | * |
|
102 | 7 | * @param string $type |
|
103 | 1 | * @param string $class |
|
104 | */ |
||
105 | 1 | private static function storeInCache($type, $class) |
|
109 | |||
110 | /** |
||
111 | 7 | * Evaulates conditions to boolean. |
|
112 | 1 | * |
|
113 | * @param mixed $condition |
||
114 | 1 | * |
|
115 | * @return bool |
||
116 | */ |
||
117 | protected static function evaluateCondition($condition) |
||
139 | } |
||
140 |