Completed
Pull Request — master (#290)
by
unknown
36:49 queued 34:03
created

PutSimpleItemToCart::quantity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 PutSimpleItemToCart
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
     * @param string $orderToken
28
     * @param string $product
29
     * @param int $quantity
30
     */
31
    public function __construct($orderToken, $product, $quantity)
32
    {
33
        Assert::string($orderToken, 'Expected order token to be string, got %s');
34
        Assert::string($product, 'Expected product code to be string, got %s');
35
        Assert::integer($quantity, 'Expected quantity to be integer, got %s');
36
        Assert::greaterThan($quantity, 0, 'Quantity should be greater than 0');
37
38
        $this->orderToken = $orderToken;
39
        $this->product = $product;
40
        $this->quantity = $quantity;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function orderToken()
47
    {
48
        return $this->orderToken;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function product()
55
    {
56
        return $this->product;
57
    }
58
59
    /**
60
     * @return int
61
     */
62
    public function quantity()
63
    {
64
        return $this->quantity;
65
    }
66
}
67