ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleSAML_Error_Assertion Class Reference
+ Inheritance diagram for SimpleSAML_Error_Assertion:
+ Collaboration diagram for SimpleSAML_Error_Assertion:

Public Member Functions

 __construct ($assertion=NULL)
 Constructor for the assertion exception. More...
 
 getAssertion ()
 Retrieve the assertion which failed. More...
 
- Public Member Functions inherited from SimpleSAML_Error_Exception
 __construct ($message, $code=0, Exception $cause=null)
 Constructor for this error. More...
 
 getBacktrace ()
 Retrieve the backtrace. More...
 
 getCause ()
 Retrieve the cause of this exception. More...
 
 getClass ()
 Retrieve the class of this exception. More...
 
 format ($anonymize=false)
 Format this exception for logging. More...
 
 formatBacktrace ($anonymize=false)
 Format the backtrace for logging. More...
 
 log ($default_level)
 Print the exception to the log, by default with log level error. More...
 
 logError ()
 Print the exception to the log with log level error. More...
 
 logWarning ()
 Print the exception to the log with log level warning. More...
 
 logInfo ()
 Print the exception to the log with log level info. More...
 
 logDebug ()
 Print the exception to the log with log level debug. More...
 
 __sleep ()
 Function for serialization. More...
 

Static Public Member Functions

static installHandler ()
 Install this assertion handler. More...
 
static onAssertion ($file, $line, $message)
 Handle assertion. More...
 
- Static Public Member Functions inherited from SimpleSAML_Error_Exception
static fromException (Exception $e)
 Convert any exception into a SimpleSAML_Error_Exception. More...
 

Private Attributes

 $assertion
 The assertion which failed, or NULL if only an expression was passed to the assert-function. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SimpleSAML_Error_Exception
 initBacktrace (Exception $exception)
 Load the backtrace from the given exception. More...
 
 logBacktrace ($level=\SimpleSAML\Logger::DEBUG)
 Print the backtrace to the log if the 'debug' option is enabled in the configuration. More...
 

Detailed Description

Definition at line 9 of file Assertion.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleSAML_Error_Assertion::__construct (   $assertion = NULL)

Constructor for the assertion exception.

Should only be called from the onAssertion handler.

Parameters
string | NULL$assertionThe assertion which failed, or NULL if the assert-function was given an expression.

Definition at line 27 of file Assertion.php.

References $assertion.

27  {
28  assert('is_null($assertion) || is_string($assertion)');
29 
30  $msg = 'Assertion failed: ' . var_export($assertion, TRUE);
31  parent::__construct($msg);
32 
33  $this->assertion = $assertion;
34  }
$assertion
The assertion which failed, or NULL if only an expression was passed to the assert-function.
Definition: Assertion.php:16

Member Function Documentation

◆ getAssertion()

SimpleSAML_Error_Assertion::getAssertion ( )

Retrieve the assertion which failed.

Returns
string|NULL The assertion which failed, or NULL if the assert-function was called with an expression.

Definition at line 42 of file Assertion.php.

References $assertion.

42  {
43  return $this->assertion;
44  }
$assertion
The assertion which failed, or NULL if only an expression was passed to the assert-function.
Definition: Assertion.php:16

◆ installHandler()

static SimpleSAML_Error_Assertion::installHandler ( )
static

Install this assertion handler.

This function will register this assertion handler. If will not enable assertions if they are disabled.

Definition at line 53 of file Assertion.php.

References array.

53  {
54 
55  assert_options(ASSERT_WARNING, 0);
56  assert_options(ASSERT_QUIET_EVAL, 0);
57  assert_options(ASSERT_CALLBACK, array('SimpleSAML_Error_Assertion', 'onAssertion'));
58  }
Create styles array
The data for the language used.

◆ onAssertion()

static SimpleSAML_Error_Assertion::onAssertion (   $file,
  $line,
  $message 
)
static

Handle assertion.

This function handles an assertion.

Parameters
string$fileThe file assert was called from.
int$lineThe line assert was called from.
mixed$messageThe expression which was passed to the assert-function.

Definition at line 70 of file Assertion.php.

References $message.

70  {
71 
72  if(!empty($message)) {
73  $exception = new self($message);
74  } else {
75  $exception = new self();
76  }
77 
78  $exception->logError();
79  }
catch(Exception $e) $message

Field Documentation

◆ $assertion

SimpleSAML_Error_Assertion::$assertion
private

The assertion which failed, or NULL if only an expression was passed to the assert-function.

Definition at line 16 of file Assertion.php.

Referenced by __construct(), and getAssertion().


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