Completed
Pull Request — master (#132)
by Łukasz
04:54
created

PutSimpleItemToCart::token()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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