/**
  * @inheritdoc
  */
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'Invalid argument value.';
     }
     parent::__construct($message, $code, $previous);
 }
 /**
  * @param string $message
  * @param \Exception $previous
  */
 public function __construct($message = null, \Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'Listeners must implements EventListenerInterface';
     }
     parent::__construct($message, $previous);
 }
 /**
  * Constructor.
  *
  * @param string $name
  * @param array  $alternatives
  */
 public function __construct($name, array $alternatives = array())
 {
     $this->name = $name;
     $this->alternatives = $alternatives;
     parent::__construct('');
     $this->update();
 }
 public function __construct($message = null)
 {
     if ($message === null) {
         $message = 'The parameter must be a non empty string';
     }
     parent::__construct($message);
 }
Example #5
0
 public function __construct($message = "", $code = 500, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('LIB_FOF_MODEL_ERR_FILTER_INVALIDFIELD');
     }
     parent::__construct($message, $code, $previous);
 }
 /**
  * Construct the exception with a type.
  * Use type from self constants.
  *
  * @param string     $type
  * @param int        $code
  * @param \Exception $previous
  */
 public function __construct($type, $code = 0, \Exception $previous = null)
 {
     if ($type != self::ROW || $type != self::COLUMN) {
         throw new parent(sprintf("Type must be %s or %s.", self::ROW, self::COLUMN));
     }
     parent::__construct(sprintf("%s number must be lower or equal than max %s number -1 and higher or equal than Zero.", lcfirst($type), $type), $code, $previous);
 }
 /**
  * Constructor.
  *
  * @param mixed        $value
  * @param string|array $expectedType
  */
 public function __construct($value, $expectedType)
 {
     if (is_array($expectedType)) {
         $expectedType = implode('", "', $expectedType);
     }
     parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
 }
Example #8
0
 /**
  * @param mixed $value
  * @param string Field $field
  * @param string $message
  */
 public function __construct($value, Field $field, $message = null)
 {
     $this->value = $value;
     $this->field = $field;
     $message = sprintf('Failed to encode [%s] for field [%s].  Detail: %s', is_scalar($this->value) ? $this->value : StringUtils::varToString($this->value), $this->field->getName(), $message);
     parent::__construct($message);
 }
Example #9
0
 public function __construct($message = "", $code = 0, Exception $previous = null)
 {
     if (empty($message)) {
         $message = 'The specified file pointer is not a valid stream resource';
     }
     parent::__construct($message, $code, $previous);
 }
Example #10
0
 /**
  * This function instantiates the exception with the specified message,
  * variables, and code.
  *
  * @access public
  * @param string $message                        the message
  * @param array $variables                       the variables
  * @param integer $code                          the code
  * @return Throwable_InvalidArgument_Exception   the exception
  */
 public function __construct($message, array $variables = NULL, $code = 0)
 {
     // Set the message
     $message = __($message, $variables);
     // Pass the message to the parent
     parent::__construct($message, $code);
 }
 public function __construct($name, $value, $expected)
 {
     if (!is_string($name)) {
         throw new InvalidArgumentException("Not a string: name");
     }
     if (!is_string($expected)) {
         throw new InvalidArgumentException("Not a string: expected");
     }
     $lead = "Invalid";
     if (NULL === $value) {
         $lead = "Not set";
     }
     $type = gettype($value);
     $got_msg = $type;
     if (is_object($value)) {
         $class = get_class($value);
         $got_msg = "{$type} ({$class})";
     }
     $this->name = $name;
     $this->type = $type;
     $this->expected = $expected;
     $this->message = $msg;
     $msg = "{$lead}: {$name} - Got: {$got_msg} - Expected: {$expected}";
     parent::__construct($msg, 0);
 }
 public function __construct($message = null)
 {
     if (null === $message) {
         $message = t('Соединение с БД не установлено.');
     }
     return parent::__construct($message);
 }
 /**
  * {@inheritdoc}
  */
 public function __construct($inputCurrency, $allowedCurrencies = null)
 {
     if (null === $allowedCurrencies) {
         $allowedCurrencies = Environment::$ALLOWED_CURRENCIES;
     }
     parent::__construct(sprintf('Invalid currency given (%s), allowed: %s', $inputCurrency, implode(', ', $allowedCurrencies)));
 }
 public function __construct(\ReflectionParameter $parameter, $message = null, $code = null, \Exception $previous = null)
 {
     if (null === $message) {
         $message = sprintf('Unable to resolve argument $%s (#%d) of %s.', $parameter->name, $parameter->getPosition(), static::getFunctionName($parameter->getDeclaringFunction()));
     }
     parent::__construct($message, $code, $previous);
 }
 public function __construct($message, array $errors, Exception $previous = null)
 {
     $flatErrors = iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($errors)), false);
     $message = $message . ":\n" . implode("\n", $flatErrors);
     parent::__construct($message, 0, $previous);
     $this->setErrors($errors);
 }
 /**
  * @param string|WeaponlikeCode $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if ($message instanceof WeaponlikeCode) {
         $message = "Given weapon-like '{$message}' is of unknown type";
     }
     parent::__construct($message, $code, $previous);
 }
Example #17
0
 public function __construct($file, $line, $message)
 {
     parent::__construct();
     $this->file = $file;
     $this->line = $line;
     $this->message = $message;
 }
 /**
  * @param string $type Type name
  * @param array $native Supported native types
  * @param \Exception $previous
  */
 public function __construct($type, array $native = array(), \Exception $previous = null)
 {
     $message = sprintf('No class or interface called "%s" exists', $type);
     if (!empty($native)) {
         $message .= sprintf('. Supported native types: %s', implode(', ', $native));
     }
     parent::__construct($message, 0, $previous);
 }
 /**
  * InvalidArgumentException constructor.
  *
  * @param string $argumentName The name of the invalid argument that caused the exception
  * @param string $expected The expected type of the invalid argument
  * @param string $actual The actual type of the invalid argument that has been given
  * @param string $previous The previous exception, if any
  */
 public function __construct($argumentName, $expected, $actual, $previous = null)
 {
     $this->setArgumentName($argumentName);
     $this->setExpected($expected);
     $this->setActual($actual);
     $this->setMessage();
     parent::__construct($this->message, $this->code, $previous);
 }
Example #20
0
 /**
  * @param string $territory_code
  * @param null $message
  * @param int $code
  * @param \Exception|null $previous
  */
 public function __construct($territory_code, $message = null, $code = 500, \Exception $previous = null)
 {
     $this->territory_code = $territory_code;
     if (!$message) {
         $message = "Territory not defined for code: {$territory_code}.";
     }
     parent::__construct($message, $code, $previous);
 }
 public function __construct($message = null, $code = 0, \Exception $previous = null, $httpStatus = 500, $details = null)
 {
     $this->_httpStatus = $httpStatus;
     if ($details !== null) {
         $this->_details = $details;
     }
     parent::__construct($message, $code, $previous);
 }
 /**
  * Constructor.
  *
  * @param string $key       The requested parameter key
  * @param string $sourceId  The service id that references the non-existent parameter
  * @param string $sourceKey The parameter key that references the non-existent parameter
  */
 public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null)
 {
     $this->key = $key;
     $this->sourceId = $sourceId;
     $this->sourceKey = $sourceKey;
     parent::__construct('', 0, $previous);
     $this->updateRepr();
 }
 public function __construct($message, $code = null, $previous = null)
 {
     if (is_array($code)) {
         if (isset($code['fileType'])) {
             $this->_fileType = $code['fileType'];
         }
     }
     parent::__construct($message, $code, $previous);
 }
 public function __construct($argumentName, $expectedType, $argument, $message = null)
 {
     $actualType = gettype($argument);
     $finalMessage = "Invalid type for argument {$argumentName}. {$actualType} given but {$expectedType} expected.";
     if ($message) {
         $finalMessage .= " " . $message;
     }
     parent::__construct($finalMessage);
 }
 public function __construct(Job $job, $newState, array $allowedStates = array())
 {
     $msg = sprintf('The Job(id = %d) cannot change from "%s" to "%s". Allowed transitions: ', $job->getId(), $job->getState(), $newState);
     $msg .= count($allowedStates) > 0 ? '"' . implode('", "', $allowedStates) . '"' : '#none#';
     parent::__construct($msg);
     $this->job = $job;
     $this->newState = $newState;
     $this->allowedStates = $allowedStates;
 }
 /**
  * Constructor.
  *
  * @param string     $key          The requested parameter key
  * @param string     $sourceId     The service id that references the non-existent parameter
  * @param string     $sourceKey    The parameter key that references the non-existent parameter
  * @param \Exception $previous     The previous exception
  * @param string[]   $alternatives Some parameter name alternatives
  */
 public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = array())
 {
     $this->key = $key;
     $this->sourceId = $sourceId;
     $this->sourceKey = $sourceKey;
     $this->alternatives = $alternatives;
     parent::__construct('', 0, $previous);
     $this->updateRepr();
 }
Example #27
0
 /**
  * Create a new data exception instance.
  *
  * @param string                                                 $message
  * @param \NilPortugues\Api\JsonApi\Server\Errors\ErrorBag|array $errors
  * @param \Exception                                             $previous
  * @param array                                                  $headers
  * @param int                                                    $code
  */
 public function __construct($message = null, $errors = null, $code = 0, Exception $previous = null)
 {
     if (is_null($errors)) {
         $this->errors = new ErrorBag();
     } else {
         $this->errors = is_array($errors) ? new ErrorBag($errors) : $errors;
     }
     parent::__construct($message, $code, $previous);
 }
 public function __construct($value, $expectedType)
 {
     $givenType = is_object($value) ? get_class($value) : gettype($value);
     if (is_array($expectedType)) {
         $message = sprintf('Expected argument of either type %s, but "%s" given.', $this->conjunctTypes($expectedType), $givenType);
     } else {
         $message = sprintf('Expected argument of type "%s", but "%s" given.', $expectedType, $givenType);
     }
     parent::__construct($message);
 }
 /**
  * @param string $templateName
  * @param Exception $previous
  */
 public function __construct($templateName, Exception $previous = null)
 {
     $this->templateName = $templateName;
     $message = sprintf('Unknown template: %s', $templateName);
     if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
         parent::__construct($message, 0, $previous);
     } else {
         parent::__construct($message);
     }
 }
 public function __construct($message, $code, $propertyPath = null, $value, array $constraints = array())
 {
     parent::__construct($message, $code);
     $this->propertyPath = $propertyPath;
     $this->value = $value;
     $this->constraints = $constraints;
 }