|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* It's free open-source software released under the MIT License. |
|
5
|
|
|
* |
|
6
|
|
|
* @author Anatoly Nekhay <[email protected]> |
|
7
|
|
|
* @copyright Copyright (c) 2018, Anatoly Nekhay |
|
8
|
|
|
* @license https://github.com/sunrise-php/http-router/blob/master/LICENSE |
|
9
|
|
|
* @link https://github.com/sunrise-php/http-router |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Sunrise\Http\Router\Validation; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @since 3.0.0 |
|
18
|
|
|
*/ |
|
19
|
|
|
final class ConstraintViolation implements ConstraintViolationInterface |
|
20
|
|
|
{ |
|
21
|
1 |
|
public function __construct( |
|
22
|
|
|
private readonly string $message, |
|
23
|
|
|
private readonly string $messageTemplate, |
|
24
|
|
|
/** @var array<string, mixed> */ |
|
25
|
|
|
private readonly array $messagePlaceholders, |
|
26
|
|
|
private readonly string $propertyPath, |
|
27
|
|
|
private readonly ?string $code, |
|
28
|
|
|
private readonly mixed $invalidValue, |
|
29
|
|
|
private readonly string $translationDomain, |
|
30
|
|
|
) { |
|
31
|
1 |
|
} |
|
32
|
|
|
|
|
33
|
1 |
|
public function getMessage(): string |
|
34
|
|
|
{ |
|
35
|
1 |
|
return $this->message; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function getMessageTemplate(): string |
|
39
|
|
|
{ |
|
40
|
1 |
|
return $this->messageTemplate; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @inheritDoc |
|
45
|
|
|
*/ |
|
46
|
1 |
|
public function getMessagePlaceholders(): array |
|
47
|
|
|
{ |
|
48
|
1 |
|
return $this->messagePlaceholders; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
1 |
|
public function getPropertyPath(): string |
|
52
|
|
|
{ |
|
53
|
1 |
|
return $this->propertyPath; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
1 |
|
public function getCode(): ?string |
|
57
|
|
|
{ |
|
58
|
1 |
|
return $this->code; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
1 |
|
public function getInvalidValue(): mixed |
|
62
|
|
|
{ |
|
63
|
1 |
|
return $this->invalidValue; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
1 |
|
public function getTranslationDomain(): string |
|
67
|
|
|
{ |
|
68
|
1 |
|
return $this->translationDomain; |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|