Class Assertion

Description

Simple interface to assert expressions

Located in /core/util/Assertion.class.php (line 37)

PHP2Go
   |
   --Assertion
Variable Summary
int $active
int $bail
mixed $callback
int $quiet
int $warning
Method Summary
void activate ()
void deactivate ()
void enableBail ()
void enableWarning ()
bool evaluate (bool $expression, [string $file = ''], [int $line = 0])
void setCallback (mixed $callback)
void _setOption (string $option, mixed $value)
Variables
int $active = 1 (line 45)

Whether evaluation is enabled

  • access: private
int $bail = 0 (line 69)

Whether an assertion failure should abort the script execution

  • access: private
mixed $callback = NULL (line 77)

Callback that should handle assertion failures

  • access: private
int $quiet = 1 (line 61)

Whether the assertion evaluation should be silent

  • access: private
int $warning = 0 (line 53)

Whether an assertion failure should throw a warning

  • access: private
Methods
Constructor Assertion (line 84)

Class constructor

Assertion Assertion ()
activate (line 104)

Activates assertion evaluation

void activate ()
deactivate (line 96)

Deactivates assertion evaluation

void deactivate ()
enableBail (line 120)

Enables script aborting upon assertion failures

void enableBail ()
enableWarning (line 112)

Enables throwing of warnings upon assertion failures

void enableWarning ()
evaluate (line 149)

Asserts a given expression

bool evaluate (bool $expression, [string $file = ''], [int $line = 0])
  • bool $expression: Boolean expression
  • string $file: File name
  • int $line: Line number
setCallback (line 136)

Define a callback to handle assertion failures

The callback function can be a string (function name), or an array (class/method or object/method).

The function signature must accept 3 arguments: $file, $line and $code.

void setCallback (mixed $callback)
  • mixed $callback: Callback function
_setOption (line 164)

Defines an assertion option

  • access: private
void _setOption (string $option, mixed $value)
  • string $option: Option name
  • mixed $value: Option value

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:20:12 -0300 by phpDocumentor 1.3.2