Public Member Functions | |
__construct ($message, $gotVar, $varName) | |
Construct a new ValueException. |
Example:
function setAge($age) { if ($age < 5 || $age > 120)) { throw new ValueException("Age too small or large", $age, "age"); } print("You're age is $age"); } function setEMail($address) { if (strpos("@", $address) === False) { throw new ValueException("Should contain '@' char", $address, "address"); } setAge(3); setEmail("f dot boender at zx dot nl");
Results in:
Uncaught exception 'ValueException' with message '$age(3): Age too small or large' in [stacktrace] Uncaught exception 'ValueException' with message '$address(f dot boender at zx dot nl): Should contain '@' char' in [stacktrace]
Definition at line 823 of file tlib.php.
TLValueException::__construct | ( | $ | message, | |
$ | gotVar, | |||
$ | varName | |||
) |
Construct a new ValueException.
$message | (string) The message which describes the value problem. | |
$gotVar | (mixed) The variable you got which did not follow expectations. | |
$varName | (string) The name of the variable (without the $ prepended) you got which did not follow expectations. |