1 | <?php |
||
26 | class EnvironmentChecker extends RequestHandler |
||
27 | { |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $url_handlers = [ |
||
32 | '' => 'index', |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $checkSuiteName; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $title; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $errorCode = 500; |
||
49 | |||
50 | /** |
||
51 | * @var null|string |
||
52 | */ |
||
53 | private static $to_email_address = null; |
||
54 | |||
55 | /** |
||
56 | * @var null|string |
||
57 | */ |
||
58 | private static $from_email_address = null; |
||
59 | |||
60 | /** |
||
61 | * @var bool |
||
62 | */ |
||
63 | private static $email_results = false; |
||
64 | |||
65 | /** |
||
66 | * @var bool Log results via {@link \Psr\Log\LoggerInterface} |
||
67 | */ |
||
68 | private static $log_results_warning = false; |
||
69 | |||
70 | /** |
||
71 | * @var string Maps to {@link \Psr\Log\LogLevel} levels. Defaults to LogLevel::WARNING |
||
72 | */ |
||
73 | private static $log_results_warning_level = LogLevel::WARNING; |
||
74 | |||
75 | /** |
||
76 | * @var bool Log results via a {@link \Psr\Log\LoggerInterface} |
||
77 | */ |
||
78 | private static $log_results_error = false; |
||
79 | |||
80 | /** |
||
81 | * @var int Maps to {@link \Psr\Log\LogLevel} levels. Defaults to LogLevel::ALERT |
||
82 | */ |
||
83 | private static $log_results_error_level = LogLevel::ALERT; |
||
84 | |||
85 | /** |
||
86 | * @param string $checkSuiteName |
||
87 | * @param string $title |
||
88 | */ |
||
89 | public function __construct($checkSuiteName, $title) |
||
96 | |||
97 | /** |
||
98 | * @param string $permission |
||
99 | * |
||
100 | * @throws HTTPResponse_Exception |
||
101 | */ |
||
102 | public function init($permission = 'ADMIN') |
||
134 | |||
135 | /** |
||
136 | * @param null|int|Member $member |
||
137 | * @param string $permission |
||
138 | * |
||
139 | * @return bool |
||
140 | * |
||
141 | * @throws HTTPResponse_Exception |
||
142 | */ |
||
143 | public function canAccess($member = null, $permission = 'ADMIN') |
||
176 | |||
177 | /** |
||
178 | * @return HTTPResponse |
||
179 | */ |
||
180 | public function index() |
||
234 | |||
235 | /** |
||
236 | * Sends a log entry to the configured PSR-3 LoggerInterface |
||
237 | * |
||
238 | * @param string $message |
||
239 | * @param int $level |
||
240 | */ |
||
241 | public function log($message, $level) |
||
245 | |||
246 | /** |
||
247 | * Set the HTTP status code that should be returned when there's an error. |
||
248 | * |
||
249 | * @param int $errorCode |
||
250 | */ |
||
251 | public function setErrorCode($errorCode) |
||
255 | |||
256 | /** |
||
257 | * @deprecated |
||
258 | * @param string $from |
||
259 | */ |
||
260 | public static function set_from_email_address($from) |
||
265 | |||
266 | /** |
||
267 | * @deprecated |
||
268 | * @return null|string |
||
269 | */ |
||
270 | public static function get_from_email_address() |
||
275 | |||
276 | /** |
||
277 | * @deprecated |
||
278 | * @param string $to |
||
279 | */ |
||
280 | public static function set_to_email_address($to) |
||
285 | |||
286 | /** |
||
287 | * @deprecated |
||
288 | * @return null|string |
||
289 | */ |
||
290 | public static function get_to_email_address() |
||
295 | |||
296 | /** |
||
297 | * @deprecated |
||
298 | * @param bool $results |
||
299 | */ |
||
300 | public static function set_email_results($results) |
||
305 | |||
306 | /** |
||
307 | * @deprecated |
||
308 | * @return bool |
||
309 | */ |
||
310 | public static function get_email_results() |
||
315 | } |
||
316 |