UpdateCart::cartItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.io and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusVueStorefrontPlugin\Command\Cart;
14
15
use BitBag\SyliusVueStorefrontPlugin\Command\CommandInterface;
16
use BitBag\SyliusVueStorefrontPlugin\Model\Request\Cart\CartItem;
17
18
class UpdateCart implements CommandInterface
19
{
20
    /** @var string|null */
21
    protected $token;
22
23
    /** @var string|null */
24
    protected $cartId;
25
26
    /** @var string */
27
    protected $orderItemUuid;
28
29
    /** @var CartItem */
30
    protected $cartItem;
31
32
    public function __construct(?string $token, ?string $cartId, CartItem $cartItem)
33
    {
34
        $this->token = $token;
35
        $this->cartId = $cartId;
36
        $this->cartItem = $cartItem;
37
    }
38
39
    public function token(): ?string
40
    {
41
        return $this->token;
42
    }
43
44
    public function cartId(): ?string
45
    {
46
        return $this->cartId;
47
    }
48
49
    public function cartItem(): CartItem
50
    {
51
        return $this->cartItem;
52
    }
53
54
    public function productOptions(): array
55
    {
56
        return $this->cartItem()->product_option->extension_attributes->configurable_item_options ?? [];
57
    }
58
59
    public function getOrderItemUuid(): string
60
    {
61
        return $this->orderItemUuid;
62
    }
63
64
    public function setOrderItemUuid(string $orderItemUuid): void
65
    {
66
        $this->orderItemUuid = $orderItemUuid;
67
    }
68
}
69