Completed
Push — master ( 842c53...e59924 )
by Joachim
14:33
created

State::getExclStatistics()   A

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
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Loevgaard\DandomainFoundation;
7
use Loevgaard\DandomainFoundation\Entity\Generated\StateInterface;
8
use Loevgaard\DandomainFoundation\Entity\Generated\StateTraits;
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="loevgaard_dandomain_states")
13
 */
14
class State implements StateInterface
15
{
16
    use StateTraits;
17
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Id
22
     * @ORM\GeneratedValue
23
     * @ORM\Column(type="integer")
24
     **/
25
    protected $id;
26
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(type="integer", unique=true)
31
     */
32
    protected $externalId;
33
34
    /**
35
     * @var bool|null
36
     *
37
     * @ORM\Column(nullable=true, type="boolean")
38
     */
39
    protected $exclStatistics;
40
41
    /**
42
     * @var bool|null
43
     *
44
     * @ORM\Column(nullable=true, type="boolean")
45
     */
46
    protected $isDefault;
47
48
    /**
49
     * @var string|null
50
     *
51
     * @ORM\Column(nullable=true, type="string", length=191)
52
     */
53
    protected $name;
54
55
    /**
56
     * Populates a shipping method based on the response from the Dandomain API
57
     *
58
     * See the properties here:
59
     * http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/OrderService/help/operations/GetOrder
60
     *
61
     * @param \stdClass|array $data
62
     * @return StateInterface
63
     */
64
    public function populateFromApiResponse($data) : StateInterface
65
    {
66
        $data = DandomainFoundation\objectToArray($data);
67
68
        $this
69
            ->setExternalId($data['id'])
70
            ->setExclStatistics($data['exclStatistics'])
71
            ->setIsDefault($data['isDefault'])
72
            ->setName($data['name'])
73
        ;
74
75
        return $this;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getId(): int
82
    {
83
        return $this->id;
84
    }
85
86
    /**
87
     * @param int $id
88
     * @return StateInterface
89
     */
90
    public function setId($id)
91
    {
92
        $this->id = $id;
93
        return $this;
94
    }
95
96
    /**
97
     * @return int
98
     */
99
    public function getExternalId(): int
100
    {
101
        return $this->externalId;
102
    }
103
104
    /**
105
     * @param int $externalId
106
     * @return StateInterface
107
     */
108
    public function setExternalId($externalId)
109
    {
110
        $this->externalId = $externalId;
111
        return $this;
112
    }
113
114
    /**
115
     * @return bool|null
116
     */
117
    public function getExclStatistics()
118
    {
119
        return $this->exclStatistics;
120
    }
121
122
    /**
123
     * @param bool|null $exclStatistics
124
     * @return StateInterface
125
     */
126
    public function setExclStatistics($exclStatistics)
127
    {
128
        $this->exclStatistics = $exclStatistics;
129
        return $this;
130
    }
131
132
    /**
133
     * @return bool|null
134
     */
135
    public function getisDefault()
136
    {
137
        return $this->isDefault;
138
    }
139
140
    /**
141
     * @param bool|null $isDefault
142
     * @return StateInterface
143
     */
144
    public function setIsDefault($isDefault)
145
    {
146
        $this->isDefault = $isDefault;
147
        return $this;
148
    }
149
150
    /**
151
     * @return null|string
152
     */
153
    public function getName()
154
    {
155
        return $this->name;
156
    }
157
158
    /**
159
     * @param null|string $name
160
     * @return StateInterface
161
     */
162
    public function setName($name)
163
    {
164
        $this->name = $name;
165
        return $this;
166
    }
167
}
168