Completed
Pull Request — master (#58)
by Ilya
01:50
created

Validate::allowArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Common\Bridge\Symfony\Bundle\Annotation;
6
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface;
8
9
/**
10
 * @Annotation
11
 */
12
final class Validate implements ConfigurationInterface
13
{
14
    /**
15
     * @var string[]
16
     */
17
    private $groups;
18
19
    /**
20
     * @var string
21
     */
22
    private $param;
23
24
    public function __construct(array $data)
25
    {
26
        $this->groups = (array) ($data['groups'] ?? $data['value']);
27
        $this->param = $data['param'] ?? 'data';
28
    }
29
30
    public function groups(): array
31
    {
32
        return $this->groups;
33
    }
34
35
    public function param(): string
36
    {
37
        return $this->param;
38
    }
39
40
    public function getAliasName(): string
41
    {
42
        return 'validate';
43
    }
44
45
    public function allowArray(): bool
46
    {
47
        return false;
48
    }
49
}
50