Ejemplo n.º 1
0
 public function __construct($param_num, $expected, $given, $search_depth = 0, $code = 0, \Exception $Previous = NULL)
 {
     $infos = \Ninaca\Utilities\Debug::whoCalledMe($search_depth);
     $class =& $infos['class'];
     $func =& $infos['function'];
     $file =& $infos['file'];
     $line =& $infos['line'];
     $class_func = !empty($class) ? "{$class}::{$func}()" : "{$func}()";
     $msg = "{$class_func} expects parameter {$param_num} to be {$expected}, " . "{$given} given.<br />" . "This function has been called in {$file} at line {$line}.<br />" . "This exception has been thrown";
     parent::__construct($msg, $code, $Previous);
 }
Ejemplo n.º 2
0
 public function __construct($msg, $search_depth = 0, $code = 0, $Previous = NULL)
 {
     Debug::checkArgs(0, 1, 'string', $msg, 1, 'nonempty', $msg, 2, 'int', $search_depth, 3, 'int', $code);
     if ($Previous !== NULL && !$Previous instanceof \Exception) {
         $type = is_object($Previous) ? get_class($Previous) : gettype($Previous);
         throw new InvalidArgumentException(4, 'NULL or an instance of \\Exception', $type);
     }
     $this->real_message = $msg;
     $infos = \Ninaca\Utilities\Debug::whoCalledMe($search_depth);
     $class =& $infos['class'];
     $func =& $infos['function'];
     $file =& $infos['file'];
     $line =& $infos['line'];
     $class_func = !empty($class) ? "{$class}::{$func}()" : "{$func}()";
     $msg = "{$class_func}: {$msg} <br/>" . "This function has been called in {$file} at line {$line}.<br />" . "This exception has been thrown";
     parent::__construct($msg, $code, $Previous);
 }