Completed
Push — master ( 483f95...829c8a )
by Julien
08:25
created

Attribute::setAttributeName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Mapado\RestClientSdk\Mapping;
4
5
/**
6
 * Class Attribute
7
 * @author Julien Deniau <[email protected]>
8
 */
9
class Attribute
10
{
11
    private $serializedKey;
12
13
    private $type;
14
15
    private $isIdentifier;
16
17
    private $attributeName;
18
19
    /**
20
     * __construct
21
     *
22
     * @param string $serializedKey
23
     * @param string $attributeName
24
     * @param string $type
25
     * @param boolean $isIdentifier
26
     * @access public
27
     */
28
    public function __construct($serializedKey, $attributeName = null, $type = 'string', $isIdentifier = false)
29
    {
30
        if (empty($serializedKey)) {
31
            throw \InvalidArgumentException('attribute name must be set');
32
        }
33
34
        $this->serializedKey = $serializedKey;
35
        $this->attributeName = $attributeName ?: $this->serializedKey;
36
        $this->type = $type;
37
        $this->isIdentifier = $isIdentifier;
38
    }
39
40
    /**
41
     * Getter for serializedKey
42
     *
43
     * @return string
44
     */
45
    public function getSerializedKey()
46
    {
47
        return $this->serializedKey;
48
    }
49
50
    /**
51
     * Setter for serializedKey
52
     *
53
     * @param string $serializedKey
54
     * @return Attribute
55
     */
56
    public function setSerializedKey($serializedKey)
57
    {
58
        $this->serializedKey = $serializedKey;
59
60
        return $this;
61
    }
62
63
    /**
64
     * Getter for type
65
     *
66
     * return string
67
     */
68
    public function getType()
69
    {
70
        return $this->type;
71
    }
72
73
    /**
74
     * Setter for type
75
     *
76
     * @param string $type
77
     * @return Attribute
78
     */
79
    public function setType($type)
80
    {
81
        $this->type = $type;
82
        return $this;
83
    }
84
85
    /**
86
     * Getter for isIdentifier
87
     *
88
     * return boolean
89
     */
90
    public function isIdentifier()
91
    {
92
        return $this->isIdentifier;
93
    }
94
95
    /**
96
     * Setter for isIdentifier
97
     *
98
     * @param boolean $isIdentifier
99
     * @return Attribute
100
     */
101
    public function setIsIdentifier($isIdentifier)
102
    {
103
        $this->isIdentifier = $isIdentifier;
104
        return $this;
105
    }
106
107
    /**
108
     * Getter for attributeName
109
     *
110
     * @return string
111
     */
112
    public function getAttributeName()
113
    {
114
        return $this->attributeName;
115
    }
116
117
    /**
118
     * Setter for attributeName
119
     *
120
     * @param string $attributeName
121
     * @return Attribute
122
     */
123
    public function setAttributeName($attributeName)
124
    {
125
        $this->attributeName = $attributeName;
126
127
        return $this;
128
    }
129
}
130