| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 76.19% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class midcom_compat_environment |
||
| 15 | { |
||
| 16 | private static $_headers = []; |
||
| 17 | |||
| 18 | private static $_implementation; |
||
| 19 | |||
| 20 | 17 | public static function get() : self |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | public static function initialize() |
|
| 26 | { |
||
| 27 | 1 | self::$_implementation = new static; |
|
| 28 | 1 | } |
|
| 29 | |||
| 30 | 17 | public function header(string $string, $replace = true, $http_response_code = null) |
|
| 31 | { |
||
| 32 | 17 | if (!defined('OPENPSA2_UNITTEST_RUN')) { |
|
| 33 | header($string, $replace, $http_response_code); |
||
| 34 | } else { |
||
| 35 | 17 | self::$_headers[] = [ |
|
| 36 | 17 | 'value' => $string, |
|
| 37 | 17 | 'replace' => $replace, |
|
| 38 | 17 | 'http_response_code' => $http_response_code |
|
| 39 | ]; |
||
| 40 | } |
||
| 41 | 17 | } |
|
| 42 | |||
| 43 | public function stop_request(string $message = '') |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | 735 | public static function flush_registered_headers() : array |
|
| 55 | } |
||
| 56 | } |
||
| 57 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.