ValidationOptions::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Maba\Bundle\RestBundle\Entity;
5
6
use Symfony\Component\Validator\Constraint;
7
8
class ValidationOptions
9
{
10
    /**
11
     * @var array of string
12
     */
13
    private $validationGroups;
14
15
    /**
16
     * @var array of string, associative
17
     */
18
    private $violationPathMap;
19
20 89
    public function __construct()
21
    {
22 89
        $this->validationGroups = [Constraint::DEFAULT_GROUP];
23 89
        $this->violationPathMap = [];
24 89
    }
25
26 81
    public function setValidationGroups(array $validationGroups): self
27
    {
28 81
        $this->validationGroups = $validationGroups;
29 81
        return $this;
30
    }
31
32 81
    public function setViolationPathMap(array $violationPathMap): self
33
    {
34 81
        $this->violationPathMap = $violationPathMap;
35 81
        return $this;
36
    }
37
38 29
    public function getValidationGroups(): array
39
    {
40 29
        return $this->validationGroups;
41
    }
42
43 81
    public function isEnabled(): bool
44
    {
45 81
        return count($this->validationGroups) > 0;
46
    }
47
48 19
    public function getViolationPathMap(): array
49
    {
50 19
        return $this->violationPathMap;
51
    }
52
}
53