function PEAR_Exception::__construct
Supported signatures:
- PEAR_Exception(string $message);
- PEAR_Exception(string $message, int $code);
- PEAR_Exception(string $message, Exception $cause);
- PEAR_Exception(string $message, Exception $cause, int $code);
- PEAR_Exception(string $message, PEAR_Error $cause);
- PEAR_Exception(string $message, PEAR_Error $cause, int $code);
- PEAR_Exception(string $message, array $causes);
- PEAR_Exception(string $message, array $causes, int $code);
Parameters
string $message exception message:
int|Exception|PEAR_Error|array|null $p2 exception cause:
int|null $p3 exception code or null:
File
-
vendor/
pear/ pear_exception/ PEAR/ Exception.php, line 120
Class
- PEAR_Exception
- Base PEAR_Exception Class
Code
public function __construct($message, $p2 = null, $p3 = null) {
if (is_int($p2)) {
$code = $p2;
$this->cause = null;
}
elseif (is_object($p2) || is_array($p2)) {
// using is_object allows both Exception and PEAR_Error
if (is_object($p2) && !$p2 instanceof Exception) {
if (!class_exists('PEAR_Error') || !$p2 instanceof PEAR_Error) {
throw new PEAR_Exception('exception cause must be Exception, ' . 'array, or PEAR_Error');
}
}
$code = $p3;
if (is_array($p2) && isset($p2['message'])) {
// fix potential problem of passing in a single warning
$p2 = array(
$p2,
);
}
$this->cause = $p2;
}
else {
$code = null;
$this->cause = null;
}
parent::__construct($message, (int) $code);
$this->signal();
}