CartItem::getCart()   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 Mapado\RestClientSdk\Tests\Model\JsonLd;
6
7
use DateTimeImmutable;
8
use Mapado\RestClientSdk\Mapping\Annotations as Rest;
9
10
/**
11
 * Class CartItem
12
 *
13
 * @author Julien Deniau <[email protected]>
14
 *
15
 * @Rest\Entity(key="cart_item")
16
 */
17
class CartItem
18
{
19
    /**
20
     * id
21
     *
22
     * @var mixed
23
     *
24
     * @Rest\Id
25
     * @Rest\Attribute(name="id", type="string")
26
     */
27
    private $id;
28
29
    /**
30
     * amount
31
     *
32
     * @var mixed
33
     *
34
     * @Rest\Attribute(name="amount", type="float")
35
     */
36
    private $amount;
37
38
    /**
39
     * createdAt
40
     *
41
     * @var ?DateTimeImmutable
42
     *
43
     * @Rest\Attribute(name="created_at", type="datetime")
44
     */
45
    private $createdAt;
46
47
    /**
48
     * data
49
     *
50
     * @var mixed
51
     *
52
     * @Rest\Attribute(name="data", type="array")
53
     */
54
    private $data = [];
55
56
    /**
57
     * cart
58
     *
59
     * @var mixed
60
     *
61
     * @Rest\ManyToOne(name="cart", targetEntity="Cart")
62
     */
63
    private $cart;
64
65
    /**
66
     * product
67
     *
68
     * @var mixed
69
     */
70
    private $product;
71
72
    /**
73
     * cartItemDetailList
74
     *
75
     * @var mixed
76
     */
77
    private $cartItemDetailList = [];
78
79
    /**
80
     * Getter for id
81
     *
82
     * @return string
83
     */
84
    public function getId()
85
    {
86
        return $this->id;
87
    }
88
89
    /**
90
     * Setter for id
91
     *
92
     * @param string $id
93
     *
94
     * @return CartItem
95
     */
96
    public function setId($id)
97
    {
98
        $this->id = $id;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Getter for amount
105
     *
106
     * @return float
107
     */
108
    public function getAmount()
109
    {
110
        return $this->amount;
111
    }
112
113
    /**
114
     * Setter for amount
115
     *
116
     * @param float $amount
117
     *
118
     * @return CartItem
119
     */
120
    public function setAmount($amount)
121
    {
122
        $this->amount = $amount;
123
124
        return $this;
125
    }
126
127
    public function getCreatedAt(): ?DateTimeImmutable
128
    {
129
        return $this->createdAt;
130
    }
131
132
    public function setCreatedAt(DateTimeImmutable $createdAt): self
133
    {
134
        $this->createdAt = $createdAt;
135
136
        return $this;
137
    }
138
139
    /**
140
     * Getter for data
141
     *
142
     * @return array
143
     */
144
    public function getData()
145
    {
146
        return $this->data;
147
    }
148
149
    /**
150
     * Setter for data
151
     *
152
     * @param array $data
153
     *
154
     * @return CartItem
155
     */
156
    public function setData(array $data)
157
    {
158
        $this->data = $data;
159
160
        return $this;
161
    }
162
163
    /**
164
     * Getter for cart
165
     *
166
     * @return Cart
167
     */
168
    public function getCart()
169
    {
170
        return $this->cart;
171
    }
172
173
    /**
174
     * Setter for cart
175
     *
176
     * @param Cart $cart
177
     *
178
     * @return CartItem
179
     */
180
    public function setCart(Cart $cart)
181
    {
182
        $this->cart = $cart;
183
        $this->cart->addCartItemList($this);
184
185
        return $this;
186
    }
187
188
    /**
189
     * Getter for product
190
     *
191
     * @return Product
192
     */
193
    public function getProduct()
194
    {
195
        return $this->product;
196
    }
197
198
    /**
199
     * Setter for product
200
     *
201
     * @param Product $product
202
     *
203
     * @return CartItem
204
     */
205
    public function setProduct(Product $product)
206
    {
207
        $this->product = $product;
208
209
        return $this;
210
    }
211
212
    /**
213
     * Getter for cartItemDetailList
214
     *
215
     * @return array
216
     */
217
    public function getCartItemDetailList()
218
    {
219
        return $this->cartItemDetailList;
220
    }
221
222
    /**
223
     * Setter for cartItemDetailList
224
     *
225
     * @param array $cartItemDetailList
226
     *
227
     * @return CartItem
228
     */
229
    public function setCartItemDetailList(array $cartItemDetailList)
230
    {
231
        $this->cartItemDetailList = $cartItemDetailList;
232
233
        return $this;
234
    }
235
236
    public function addCartItemDetailList($itemDetail)
237
    {
238
        $this->cartItemDetailList[] = $itemDetail;
239
240
        return $this;
241
    }
242
}
243