for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package midcom.compat
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
*/
* Support for interactions with environment
*
class midcom_compat_environment
{
private static array $_headers = [];
public static function header(string $string, bool $replace = true, int $http_response_code = 0)
if (!defined('OPENPSA2_UNITTEST_RUN')) {
header($string, $replace, $http_response_code);
} else {
self::$_headers[] = [
'value' => $string,
'replace' => $replace,
'http_response_code' => $http_response_code
];
}
public static function stop_request(string $message)
exit($message);
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
public static function flush_registered_headers() : array
$headers = self::$_headers;
self::$_headers = [];
return $headers;
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.