SDK for PHP 3.x

NeedsTrait

Trait NeedsTrait

Table of Contents

Methods

needs()  : mixed
Preconditions, postconditions, and loop invariants are very useful for safe programing. They also document the specifications.

Methods

needs()

Preconditions, postconditions, and loop invariants are very useful for safe programing. They also document the specifications.

public static needs( $condition,  $errorMessage[, null $exceptionClass = null ]) : mixed

This function is to help simplify the semantic burden of parsing these constructions.

Instead of constructions like if (!(GOOD CONDITION)) { throw new \Exception('condition not true'); }

you can write: needs(GOOD CONDITION, 'condition not true');

Parameters
$condition :
$errorMessage :
$exceptionClass : null = null
On this page