Deserialize::allowArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
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 Deserialize implements ConfigurationInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    private $class;
18
19
    /**
20
     * @var bool
21
     */
22
    private $validate;
23
24
    /**
25
     * @var string[]
26
     */
27
    private $groups;
28
29
    /**
30
     * @var string
31
     */
32
    private $param;
33
34
    public function __construct(array $data)
35
    {
36
        $this->class = $data['class'] ?? $data['value'];
37
        $this->validate = $data['validate'] ?? false;
38
        $this->groups = $data['groups'] ?? [];
39
        $this->param = $data['param'] ?? 'data';
40
    }
41
42
    public function className(): string
43
    {
44
        return $this->class;
45
    }
46
47
    public function validate(): bool
48
    {
49
        return $this->validate;
50
    }
51
52
    public function groups(): array
53
    {
54
        return $this->groups;
55
    }
56
57
    public function param(): string
58
    {
59
        return $this->param;
60
    }
61
62
    public function getAliasName(): string
63
    {
64
        return 'deserialize';
65
    }
66
67
    public function allowArray(): bool
68
    {
69
        return false;
70
    }
71
}
72