ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Whoops\Util\Misc Class Reference
+ Collaboration diagram for Whoops\Util\Misc:

Static Public Member Functions

static canSendHeaders ()
 Can we at this point in time send HTTP headers? More...
 
static isAjaxRequest ()
 
static isCommandLine ()
 Check, if possible, that this execution was triggered by a command line. More...
 
static translateErrorCode ($error_code)
 Translate ErrorException code into the represented constant. More...
 
static isLevelFatal ($level)
 Determine if an error level is fatal (halts execution) More...
 

Detailed Description

Definition at line 9 of file Misc.php.

Member Function Documentation

◆ canSendHeaders()

static Whoops\Util\Misc::canSendHeaders ( )
static

Can we at this point in time send HTTP headers?

Currently this checks if we are even serving an HTTP request, as opposed to running from a command line.

If we are serving an HTTP request, we check if it's not too late.

Returns
bool

Definition at line 21 of file Misc.php.

References $_SERVER.

22  {
23  return isset($_SERVER["REQUEST_URI"]) && !headers_sent();
24  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

◆ isAjaxRequest()

static Whoops\Util\Misc::isAjaxRequest ( )
static

Definition at line 26 of file Misc.php.

References $_SERVER.

27  {
28  return (
29  !empty($_SERVER['HTTP_X_REQUESTED_WITH'])
30  && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
31  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

◆ isCommandLine()

static Whoops\Util\Misc::isCommandLine ( )
static

Check, if possible, that this execution was triggered by a command line.

Returns
bool

Definition at line 37 of file Misc.php.

38  {
39  return PHP_SAPI == 'cli';
40  }

◆ isLevelFatal()

static Whoops\Util\Misc::isLevelFatal (   $level)
static

Determine if an error level is fatal (halts execution)

Parameters
int$level
Returns
bool

Definition at line 67 of file Misc.php.

References $errors.

Referenced by Whoops\Exception\Inspector\getTrace().

68  {
69  $errors = E_ERROR;
70  $errors |= E_PARSE;
71  $errors |= E_CORE_ERROR;
72  $errors |= E_CORE_WARNING;
73  $errors |= E_COMPILE_ERROR;
74  $errors |= E_COMPILE_WARNING;
75  return ($level & $errors) > 0;
76  }
$errors
Definition: index.php:6
+ Here is the caller graph for this function:

◆ translateErrorCode()

static Whoops\Util\Misc::translateErrorCode (   $error_code)
static

Translate ErrorException code into the represented constant.

Parameters
int$error_code
Returns
string
Examples:
/usr/local/src/ilias/release_5-4/libs/composer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php.

Definition at line 48 of file Misc.php.

Referenced by Whoops\Handler\PrettyPageHandler\getExceptionCode().

49  {
50  $constants = get_defined_constants(true);
51  if (array_key_exists('Core', $constants)) {
52  foreach ($constants['Core'] as $constant => $value) {
53  if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {
54  return $constant;
55  }
56  }
57  }
58  return "E_UNKNOWN";
59  }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: