Completed
Pull Request — master (#11)
by Eric
62:01
created

XmlList::getEntryAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Ivory Serializer package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\Serializer\Mapping\Annotation;
13
14
/**
15
 * @Annotation
16
 * @Target({"PROPERTY", "METHOD"})
17
 *
18
 * @author GeLo <[email protected]>
19
 */
20
class XmlList
21
{
22
    /**
23
     * @var string|null
24
     */
25
    private $entry;
26
27
    /**
28
     * @var string|null
29
     */
30
    private $entryAttribute;
31
32
    /**
33
     * @var bool
34
     */
35
    private $keyAsAttribute = false;
36
37
    /**
38
     * @var bool
39
     */
40
    private $keyAsNode = false;
41
42
    /**
43
     * @var bool
44
     */
45
    private $inline = false;
46
47
    /**
48
     * @param mixed[] $data
49
     */
50
    public function __construct(array $data)
51
    {
52
        if (isset($data['entry'])) {
53
            $this->entry = $data['entry'];
54
        }
55
56
        if (isset($data['entry_attribute'])) {
57
            $this->entryAttribute = $data['entry_attribute'];
58
        }
59
60
        if (isset($data['key_as_attribute'])) {
61
            $this->keyAsAttribute = $data['key_as_attribute'];
62
        }
63
64
        if (isset($data['key_as_node'])) {
65
            $this->keyAsNode = $data['key_as_node'];
66
        }
67
68
        if (isset($data['inline'])) {
69
            $this->inline = $data['inline'];
70
        }
71
    }
72
73
    /**
74
     * @return bool
75
     */
76
    public function hasEntry()
77
    {
78
        return $this->entry !== null;
79
    }
80
81
    /**
82
     * @return string|null
83
     */
84
    public function getEntry()
85
    {
86
        return $this->entry;
87
    }
88
89
    /**
90
     * @return bool
91
     */
92
    public function hasEntryAttribute()
93
    {
94
        return $this->entryAttribute !== null;
95
    }
96
97
    /**
98
     * @return string|null
99
     */
100
    public function getEntryAttribute()
101
    {
102
        return $this->entryAttribute;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108
    public function useKeyAsAttribute()
109
    {
110
        return $this->keyAsAttribute;
111
    }
112
113
    /**
114
     * @return bool
115
     */
116
    public function useKeyAsNode()
117
    {
118
        return $this->keyAsNode;
119
    }
120
121
    /**
122
     * @return bool
123
     */
124
    public function isInline()
125
    {
126
        return $this->inline;
127
    }
128
}
129