forked from selective-php/validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidationException.php
More file actions
47 lines (41 loc) · 1.14 KB
/
ValidationException.php
File metadata and controls
47 lines (41 loc) · 1.14 KB
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 Selective\Validation\Exception;
use DomainException;
use Selective\Validation\ValidationResult;
use Throwable;
/**
* Validation Exception.
*/
final class ValidationException extends DomainException
{
/**
* @var ValidationResult|null
*/
private $validationResult;
/**
* Construct the exception.
*
* @param string $message The Exception message to throw
* @param ValidationResult|null $validationResult The validation result object
* @param int $code The Exception code
* @param Throwable|null $previous The previous throwable used for the exception chaining
*/
public function __construct(
string $message,
?ValidationResult $validationResult = null,
int $code = 422,
?Throwable $previous = null
) {
parent::__construct($message, $code, $previous);
$this->validationResult = $validationResult;
}
/**
* Get the validation result.
*
* @return ValidationResult|null The validation result
*/
public function getValidationResult(): ?ValidationResult
{
return $this->validationResult;
}
}