/** * Constructor. * * @param string $argumentName Argument name * @param string $message The error message * @param \Exception $innerException An inner exception */ public function __construct($argumentName, $message = '', \Exception $innerException = null) { if ($message == '') { $message = $argumentName . ' cannot be null'; } parent::__construct($argumentName, $message, $innerException); }
/** * @param string $argumentName Argument name * @param string $message The error message * @param \Exception $innerException An inner exception */ public function __construct($argumentName, $message = '', \Exception $innerException = null) { if ($message == '') { $message = $argumentName . ' is out of range'; } parent::__construct($argumentName, $message, $innerException); }
/** * @param string $variableName * @param int|float|bool|resource|array $variableValue * @throws InvalidNotEmptyException * @throws InvalidNotIntException * @throws InvalidNotStringException * @throws InvalidStringException */ public function __construct($variableName, $variableValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } parent::__construct(sprintf('Variable "$%s" must be not same as: "%s"', $variableName, print_r($variableValue, true))); }
/** * @param string $variableName * @throws InvalidStringException */ public function __construct($variableName) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } parent::__construct(sprintf('Variable "$%s" must be "not null" and "not int"', $variableName)); }
/** * @param string $variableName * @param string $key * @throws InvalidIntOrStringException * @throws InvalidNotEmptyException * @throws InvalidStringException */ public function __construct($variableName, $key) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_int($key) && !is_string($key)) { throw new InvalidIntOrStringException('key', $key); } parent::__construct(sprintf('Variable "$%s" must contain key: "%s"', $variableName, $key)); }
/** * @param string $variableName * @param string $variableValue * @throws InvalidStringException */ public function __construct($variableName, $variableValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_string($variableValue)) { throw new InvalidStringException('variableValue', $variableValue); } parent::__construct(sprintf('Variable "$%s" must be "correct RegExp pattern", actual value: "%s"', $variableName, $variableValue)); }
/** * @param string $variableName * @param array|bool|float|int|null|string $variableValue * @throws InvalidNotResourceException * @throws InvalidStringException */ public function __construct($variableName, $variableValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (is_resource($variableValue)) { throw new InvalidNotResourceException('variableValue'); } parent::__construct(sprintf('Variable "$%s" must be "resource", actual type: "%s"', $variableName, gettype($variableValue))); }
/** * @param string $variableName * @param int|float|bool|resource|array $variableValue * @throws InvalidNotIntAndNotStringException * @throws InvalidNotEmptyException * @throws InvalidStringException */ public function __construct($variableName, $variableValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (is_int($variableValue) || is_string($variableValue)) { throw new InvalidNotIntAndNotStringException($variableName); } parent::__construct(sprintf('Variable "$%s" must be: "int" or "string", actual type: "%s"', $variableName, gettype($variableValue))); }
/** * @param string $variableName * @param int|float|bool|resource|array $variableValue * @param int|float|bool|resource|array $anotherValue * @throws InvalidNotEmptyException * @throws InvalidStringException * @throws InvalidNotSameValueException */ public function __construct($variableName, $variableValue, $anotherValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif ($variableValue === $anotherValue) { throw new InvalidNotSameValueException('variableValue', $variableValue); } parent::__construct(sprintf('Variable "$%s" must be same as: "%s", actual value: "%s"', $variableName, print_r($anotherValue, true), print_r($variableValue, true))); }
public function __construct($parameter, \Exception $previous = null) { /*$message = Loc::getMessage( "argument_null_exception_message", array("#PARAMETER#" => $parameter) );*/ $message = sprintf("Argument '%s' is null or empty", $parameter); parent::__construct($message, $parameter, $previous); }
/** * @param string $variableName * @param mixed $variableValue * @param array $array * @throws InvalidArrayException * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $array) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_array($array)) { throw new InvalidArrayException('array', $array); } parent::__construct(sprintf('Variable "$%s" must be "in array" {%s}, actual value: "%s"', $variableName, print_r($array, true), print_r($variableValue, true))); }
/** * @param string $variableName * @param int $variableValue * @throws InvalidIntOrFloatException * @throws InvalidStringException */ public function __construct($variableName, $variableValue) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_int($variableValue) && !is_float($variableValue)) { throw new InvalidIntOrFloatException('variableValue', $variableValue); } parent::__construct(sprintf('Variable "$%s" must be "positive", actual value: "%s"', $variableName, $variableValue)); }
/** * Creates new exception object * * @param string $parameter Argument that generates exception * @param string $requiredType Required type * @param \Exception $previous */ public function __construct($parameter, $requiredType = "", \Exception $previous = null) { if (!empty($requiredType)) { $message = sprintf("The value of an argument '%s' must be of type %s", $parameter, $requiredType); } else { $message = sprintf("The value of an argument '%s' has an invalid type", $parameter); } $this->requiredType = $requiredType; parent::__construct($message, $parameter, $previous); }
/** * @param string $variableName * @param int|float $variableValue * @param int|float $number * @throws InvalidIntOrFloatException * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $number) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_int($variableValue) && !is_float($variableValue)) { throw new InvalidIntOrFloatException('variableValue', $variableValue); } elseif (!is_int($number) && !is_float($number)) { throw new InvalidIntOrFloatException('number', $number); } parent::__construct(sprintf('Variable "$%s" must be strictly greater than "%s", actual value: "%s"', $variableName, (string) $number, (string) $variableValue)); }
/** * @param string $variableName * @param string $variableValue * @param string $pattern * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $pattern) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_string($variableValue)) { throw new InvalidStringException('variableValue', $variableValue); } elseif (!is_string($pattern)) { throw new InvalidStringException('pattern', $pattern); } parent::__construct(sprintf('Variable "$%s" must match glob pattern "%s", actual value: "%s"', $variableName, $pattern, $variableValue)); }
/** * @param string $variableName * @param string $variableValue * @param int $length * @throws InvalidIntException * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $length) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_string($variableValue)) { throw new InvalidStringException('variableValue', $variableValue); } elseif (!is_int($length)) { throw new InvalidIntException('length', $length); } parent::__construct(sprintf('Variable "$%s" must have length "%d", actual length: "%d"', $variableName, $length, mb_strlen($variableValue))); }
/** * @param string $variableName * @param array $variableValue * @param int $count * @throws InvalidArrayException * @throws InvalidIntException * @throws InvalidNotEmptyException * @throws InvalidStringException * @throws NumberNotGreaterException */ public function __construct($variableName, $variableValue, $count) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_array($variableValue)) { throw new InvalidArrayException('variableValue', $variableValue); } elseif (!is_int($count)) { throw new InvalidIntException('count', $count); } elseif ($count < 0) { throw new NumberNotGreaterException('count', $count, 0); } parent::__construct(sprintf('Variable "$%s" must contain: "%d" elements, actual count: "%d"', $variableName, $count, count($variableValue))); }
/** * @param string $variableName * @param string $variableValue * @param int $from * @param int $to * @throws InvalidIntException * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $from, $to) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_string($variableValue)) { throw new InvalidStringException('variableValue', $variableValue); } elseif (!is_int($from)) { throw new InvalidIntException('from', $from); } elseif (!is_int($to)) { throw new InvalidIntException('to', $to); } parent::__construct(sprintf('Variable "$%s" must have length between "%d" and "%d", actual length: "%d"', $variableName, $from, $to, mb_strlen($variableValue))); }
/** * @param string $variableName * @param int|float $variableValue * @param int|float $from * @param int|float $to * @throws InvalidIntOrFloatException * @throws InvalidStringException */ public function __construct($variableName, $variableValue, $from, $to) { if (!is_string($variableName)) { throw new InvalidStringException('variableName', $variableName); } elseif (!is_int($variableValue) && !is_float($variableValue)) { throw new InvalidIntOrFloatException('variableValue', $variableValue); } elseif (!is_int($from) && !is_float($from)) { throw new InvalidIntOrFloatException('from', $from); } elseif (!is_int($to) && !is_float($to)) { throw new InvalidIntOrFloatException('to', $to); } parent::__construct(sprintf('Variable "$%s" must be between "%s" and "%s", actual value: "%s"', $variableName, (string) $from, (string) $to, (string) $variableValue)); }
/** * Creates new exception object. * * @param string $parameter Argument that generates exception * @param null $lowerLimit Either lower limit of the allowable range of values or an array of allowable values * @param null $upperLimit Upper limit of the allowable values * @param \Exception $previous */ public function __construct($parameter, $lowerLimit = null, $upperLimit = null, \Exception $previous = null) { if (is_array($lowerLimit)) { $message = sprintf("The value of an argument '%s' is outside the allowable range of values: %s", $parameter, implode(", ", $lowerLimit)); } elseif ($lowerLimit !== null && $upperLimit !== null) { $message = sprintf("The value of an argument '%s' is outside the allowable range of values: from %s to %s", $parameter, $lowerLimit, $upperLimit); } elseif ($lowerLimit === null && $upperLimit !== null) { $message = sprintf("The value of an argument '%s' is outside the allowable range of values: not greater than %s", $parameter, $upperLimit); } elseif ($lowerLimit !== null && $upperLimit === null) { $message = sprintf("The value of an argument '%s' is outside the allowable range of values: not less than %s", $parameter, $lowerLimit); } else { $message = sprintf("The value of an argument '%s' is outside the allowable range of values", $parameter); } $this->lowerLimit = $lowerLimit; $this->upperLimit = $upperLimit; parent::__construct($message, $parameter, $previous); }
public function __construct($parameter, \Exception $previous = null) { $message = sprintf("Argument '%s' is null or empty", $parameter); parent::__construct($message, $parameter, $previous); }
protected function ArgumentOutOfRangeException_2($paramName, Exception $innerException = null) { parent::SystemException_2($paramName . ' is out of range.', $innerException); }
public function __construct($parameter = "", \Exception $previous = null) { parent::__construct("Object property \"" . $parameter . "\" not found.", $parameter, $previous); }
function __construct($argName, $argValue, $message = 'key violation') { parent::__construct($argName, $message); $this->value = $argValue; }
/** * @param string $argumentName * @param string $message */ function __construct($argumentName, $expectedType, $message = 'unexpected argument type') { Assert::isScalar($expectedType); parent::__construct($argumentName, $expectedType, $message); $this->expectedType = $expectedType; }
/** * @param string $argument * @param string $type */ public function __construct($argument = null, $type = null) { parent::__construct('The specified argument is of a wrong type.'); $this->isDisplayable = false; }
protected function ArgumentNullException_2($paramName, Exception $innerException = null) { parent::SystemException_2($paramName . ' is null.', $innerException); }
/** * Initializes a new instance of that class. * * @param mixed $actualValue The underlying value. * @param string $paramName The name of the underlying parameter. * @param string $message The message. * @param int $code The code. * @param \Exception $innerException The inner exception. */ public function __construct($actualValue = null, $paramName = null, $message = null, \Exception $innerException = null, $code = 0) { $this->_actualValue = $actualValue; parent::__construct($paramName, $message, $innerException, $code); }