Passed
Pull Request — master (#1)
by Igor
04:51
created

StockMovement::setVariantCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusStockMovementPlugin\Model;
6
7
use Money\Money;
8
use Sylius\Component\Core\Model\ProductVariantInterface;
9
use Sylius\Component\Resource\Model\TimestampableTrait;
10
11
class StockMovement implements StockMovementInterface
12
{
13
    use TimestampableTrait;
14
15
    /** @var int */
16
    protected $id;
17
18
    /** @var int */
19
    protected $quantity;
20
21
    /** @var ProductVariantInterface|null */
22
    protected $variant;
23
24
    /** @var string */
25
    protected $variantCode;
26
27
    /** @var Money */
28
    protected $price;
29
30
    /** @var Money */
31
    protected $convertedPrice;
32
33
    /** @var string|null */
34
    protected $reference;
35
36
    public function getId(): ?int
37
    {
38
        return $this->id;
39
    }
40
41
    public function getQuantity(): ?int
42
    {
43
        return $this->quantity;
44
    }
45
46
    public function setQuantity(int $quantity): void
47
    {
48
        $this->quantity = $quantity;
49
    }
50
51
    public function getVariant(): ?ProductVariantInterface
52
    {
53
        return $this->variant;
54
    }
55
56
    public function setVariant(?ProductVariantInterface $variant): void
57
    {
58
        $this->variant = $variant;
59
60
        if (null !== $variant) {
61
            $this->variantCode = (string) $variant->getCode();
62
        }
63
    }
64
65
    public function getVariantCode(): ?string
66
    {
67
        return $this->variantCode;
68
    }
69
70
    public function getPrice(): ?Money
71
    {
72
        return $this->price;
73
    }
74
75
    public function setPrice(Money $price): void
76
    {
77
        $this->price = $price;
78
    }
79
80
    public function getConvertedPrice(): ?Money
81
    {
82
        return $this->convertedPrice;
83
    }
84
85
    public function setConvertedPrice(Money $convertedPrice): void
86
    {
87
        $this->convertedPrice = $convertedPrice;
88
    }
89
90
    public function getReference(): ?string
91
    {
92
        return $this->reference;
93
    }
94
95
    public function setReference(?string $reference): void
96
    {
97
        $this->reference = $reference;
98
    }
99
}
100