forked from illuminate/validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathValidationException.php
47 lines (40 loc) · 997 Bytes
/
ValidationException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Illuminate\Validation;
use Exception;
class ValidationException extends Exception
{
/**
* The validator instance.
*
* @var \Illuminate\Validation\Validator
*/
public $validator;
/**
* The recommended response to send to the client.
*
* @var \Illuminate\Http\Response|null
*/
public $response;
/**
* Create a new exception instance.
*
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Http\Response $response
* @return void
*/
public function __construct($validator, $response = null)
{
parent::__construct('The given data failed to pass validation.');
$this->response = $response;
$this->validator = $validator;
}
/**
* Get the underlying response instance.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getResponse()
{
return $this->response;
}
}