CakeFest 2017 NYC, the Official CakePHP Conference

کلاس UnexpectedValueException

Introduction

استثنا ایحاد شده هنگام عدم تطبیق مقدار با یک مجموعه مقدار

Class synopsis

UnexpectedValueException extends RuntimeException {
/* Inherited methods */
final public string Exception::getMessage ( void )
final public int Exception::getCode ( void )
final public string Exception::getFile ( void )
final public int Exception::getLine ( void )
final public array Exception::getTrace ( void )
final public string Exception::getTraceAsString ( void )
public string Exception::__toString ( void )
final private void Exception::__clone ( void )
}
add a note add a note

User Contributed Notes 1 note

up
-2
evguenia dot chagnon at gmail dot com
1 month ago
const TYPE_FOO = 'foo';
const TYPE_BAR = 'bar';

public function doSomething($x) {
   if($x != self::TYPE_FOO || $x != self::TYPE_BAR) {
       throw new UnexpectedValueException('Le paramètre doit être l\'une des constantes TYPE_*');
   }
}
To Top