Completed
Pull Request — master (#290)
by
unknown
41:51
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\SyliusShopApiPlugin\Command;
6
7
use Webmozart\Assert\Assert;
8
9 View Code Duplication
final class PutVariantBasedConfigurableItemToCart
10
{
11
    /**
12
     * @var string
13
     */
14
    private $orderToken;
15
16
    /**
17
     * @var string
18
     */
19
    private $product;
20
21
    /**
22
     * @var int
23
     */
24
    private $quantity;
25
26
    /**
27
     * @var string
28
     */
29
    private $productVariant;
30
31
    /**
32
     * @param string $orderToken
33
     * @param string $product
34
     * @param string $productVariant
35
     * @param int $quantity
36
     */
37
    public function __construct($orderToken, $product, $productVariant, $quantity)
38
    {
39
        Assert::string($orderToken, 'Expected order token to be string, got %s');
40
        Assert::string($product, 'Expected product code to be string, got %s');
41
        Assert::string($productVariant, 'Expected product variant code to be string, got %s');
42
        Assert::integer($quantity, 'Expected quantity to be integer, got %s');
43
        Assert::greaterThan($quantity, 0, 'Quantity should be greater than 0');
44
45
        $this->orderToken = $orderToken;
46
        $this->product = $product;
47
        $this->quantity = $quantity;
48
        $this->productVariant = $productVariant;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function orderToken()
55
    {
56
        return $this->orderToken;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function product()
63
    {
64
        return $this->product;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function productVariant()
71
    {
72
        return $this->productVariant;
73
    }
74
75
    /**
76
     * @return int
77
     */
78
    public function quantity()
79
    {
80
        return $this->quantity;
81
    }
82
}
83