public function __construct($message = null, $errors = null, \Exception $previous = null, $code = 0)
 {
     if (is_null($errors)) {
         $this->errors = new MessageBag();
     } else {
         $this->errors = is_array($errors) ? new MessageBag($errors) : $errors;
     }
     return parent::__construct($message, $previous, $code);
 }
 /**
  * Test that setting the headers using the setter function
  * is working as expected.
  *
  * @param array $headers The headers to set
  *
  * @dataProvider headerDataProvider
  */
 public function testHeadersSetter($headers)
 {
     $exception = new UnprocessableEntityHttpException(10);
     $exception->setHeaders($headers);
     $this->assertSame($headers, $exception->getHeaders());
 }
Exemplo n.º 3
0
 /**
  * @param \RREST\Error[]  $errors   List of errors
  * @param \Exception|null $previous
  */
 public function __construct(array $errors, $message = 'Invalid', \Exception $previous = null, $code = 0)
 {
     $this->errors = $errors;
     parent::__construct($message, $previous, $code);
 }