ConstraintViolation::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 7
dl 0
loc 10
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 0
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