Deserialize   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A groups() 0 3 1
A param() 0 3 1
A allowArray() 0 3 1
A validate() 0 3 1
A getAliasName() 0 3 1
A className() 0 3 1
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