Completed
Push — master ( 66b796...ebbacf )
by Kamil
17:43 queued 10:16
created

ChangeItemQuantity::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

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