1 | <?php |
||
37 | class EnvironmentCheckSuite |
||
38 | { |
||
39 | use Configurable; |
||
40 | use Injectable; |
||
41 | use Extensible; |
||
42 | /** |
||
43 | * Name of this suite. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $name; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $checks = []; |
||
53 | |||
54 | /** |
||
55 | * Associative array of named checks registered via the config system. Each check should specify: |
||
56 | * - definition (e.g. 'MyHealthCheck("my param")') |
||
57 | * - title (e.g. 'Is my feature working?') |
||
58 | * - state (setting this to 'disabled' will cause suites to skip this check entirely. |
||
59 | * |
||
60 | * @var array |
||
61 | */ |
||
62 | private static $registered_checks = []; |
||
|
|||
63 | |||
64 | /** |
||
65 | * Associative array of named suites registered via the config system. Each suite should enumerate |
||
66 | * named checks that have been configured in 'registered_checks'. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | private static $registered_suites = []; |
||
71 | |||
72 | /** |
||
73 | * Load checks for this suite from the configuration system. This is an alternative to the |
||
74 | * EnvironmentCheckSuite::register - both can be used, checks will be appended to the suite. |
||
75 | * |
||
76 | * @param string $suiteName The name of this suite. |
||
77 | */ |
||
78 | public function __construct($suiteName) |
||
105 | |||
106 | /** |
||
107 | * Run this test suite and return the result code of the worst result. |
||
108 | * |
||
109 | * @return int |
||
110 | */ |
||
111 | public function run() |
||
129 | |||
130 | /** |
||
131 | * Get instances of all the environment checks. |
||
132 | * |
||
133 | * @return array |
||
134 | * @throws InvalidArgumentException |
||
135 | */ |
||
136 | protected function checkInstances() |
||
158 | |||
159 | /** |
||
160 | * Add a check to this suite. |
||
161 | * |
||
162 | * @param mixed $check |
||
163 | * @param string $title |
||
164 | */ |
||
165 | public function push($check, $title = null) |
||
172 | |||
173 | ///////////////////////////////////////////////////////////////////////////////////////////// |
||
174 | |||
175 | /** |
||
176 | * @var array |
||
177 | */ |
||
178 | protected static $instances = []; |
||
179 | |||
180 | /** |
||
181 | * Return a named instance of EnvironmentCheckSuite. |
||
182 | * |
||
183 | * @param string $name |
||
184 | * |
||
185 | * @return EnvironmentCheckSuite |
||
186 | */ |
||
187 | public static function inst($name) |
||
194 | |||
195 | /** |
||
196 | * Register a check against the named check suite. |
||
197 | * |
||
198 | * @param string|array $names |
||
199 | * @param EnvironmentCheck $check |
||
200 | * @param string|array |
||
201 | */ |
||
202 | public static function register($names, $check, $title = null) |
||
212 | |||
213 | /** |
||
214 | * Unregisters all checks. |
||
215 | */ |
||
216 | public static function reset() |
||
220 | } |
||
221 |
This check marks private properties in classes that are never used. Those properties can be removed.