ValidationExceptionError   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 64
ccs 6
cts 14
cp 0.4286
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
A getProperty() 0 4 1
A getMessage() 0 4 1
A getConstraint() 0 4 1
1
<?php
2
/**
3
 * ValidationExceptionError class file
4
 */
5
6
namespace Graviton\JsonSchemaBundle\Exception;
7
8
/**
9
 * ValidationExceptionError
10
 *
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  https://opensource.org/licenses/MIT MIT License
13
 * @link     http://swisscom.ch
14
 */
15
class ValidationExceptionError
16
{
17
18
    /**
19
     * @var string
20
     */
21
    private $property;
22
23
    /**
24
     * @var string
25
     */
26
    private $message;
27
28
    /**
29
     * @var string
30
     */
31
    private $constraint;
32
33
    /**
34
     * @param array $error errpr
35
     */
36 1
    public function __construct(array $error)
37
    {
38 1
        if (isset($error['property'])) {
39
            $this->property = $error['property'];
40
        }
41 1
        if (isset($error['message'])) {
42 1
            $this->message = $error['message'];
43
        }
44 1
        if (isset($error['constraint'])) {
45
            $this->constraint = $error['constraint'];
46
        }
47 1
    }
48
49
    /**
50
     * get property path
51
     *
52
     * @return string
53
     */
54
    public function getProperty()
55
    {
56
        return $this->property;
57
    }
58
59
    /**
60
     * get message
61
     *
62
     * @return string
63
     */
64
    public function getMessage()
65
    {
66
        return $this->message;
67
    }
68
69
    /**
70
     * get constraint name
71
     *
72
     * @return string
73
     */
74
    public function getConstraint()
75
    {
76
        return $this->constraint;
77
    }
78
}
79