ConstraintViolation::getMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace ElevenLabs\Api\Validator;
3
4
/**
5
 * ValueObject that contains constraint violation properties
6
 */
7
class ConstraintViolation
8
{
9
    /** @var string */
10
    private $property;
11
12
    /** @var string */
13
    private $message;
14
15
    /** @var string */
16
    private $constraint;
17
18
    /** @var string */
19
    private $location;
20
21
    /**
22
     * @param string $property
23
     * @param string $message
24
     * @param string $constraint
25
     * @param string $location
26
     */
27
    public function __construct($property, $message, $constraint, $location)
28 8
    {
29
        $this->property = $property;
30
        $this->message = $message;
31
        $this->constraint = $constraint;
32
        $this->location = $location;
33
    }
34 8
35 8
    /**
36 8
     * @return string
37 8
     */
38 8
    public function getProperty()
39
    {
40 1
        return $this->property;
41
    }
42 1
43
    /**
44
     * @return string
45 1
     */
46
    public function getMessage()
47 1
    {
48
        return $this->message;
49
    }
50 1
51
    /**
52 1
     * @return string
53
     */
54
    public function getConstraint()
55 1
    {
56
        return $this->constraint;
57 1
    }
58
59
    /**
60 1
     * @return string
61
     */
62
    public function getLocation()
63 1
    {
64 1
        return $this->location;
65 1
    }
66 1
67
    public function toArray()
68
    {
69
        return [
70
            'property' => $this->getProperty(),
71
            'message' => $this->getMessage(),
72
            'constraint' => $this->getConstraint(),
73
            'location' => $this->getLocation()
74
        ];
75
    }
76
}
77