Passed
Pull Request — master (#45)
by
unknown
04:02
created

WishlistProduct::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusWishlistPlugin\Entity;
14
15
use Sylius\Component\Core\Model\ProductInterface;
16
use Sylius\Component\Core\Model\ProductVariantInterface;
17
18
class WishlistProduct implements WishlistProductInterface
19
{
20
    protected ?int $id;
21
22
    protected WishlistInterface $wishlist;
23
24
    protected ?ProductInterface $product;
25
26
    protected ?ProductVariantInterface $variant;
27
28
    protected int $quantity = 0;
29
30
    public function __construct()
31
    {
32
        $this->id = null;
33
    }
34
35
    public function getId(): ?int
36
    {
37
        return $this->id;
38
    }
39
40
    public function getWishlist(): WishlistInterface
41
    {
42
        return $this->wishlist;
43
    }
44
45
    public function setWishlist(WishlistInterface $wishlist): void
46
    {
47
        $this->wishlist = $wishlist;
48
    }
49
50
    public function getProduct(): ProductInterface
51
    {
52
        return $this->product;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->product could return the type null which is incompatible with the type-hinted return Sylius\Component\Core\Model\ProductInterface. Consider adding an additional type-check to rule them out.
Loading history...
53
    }
54
55
    public function setProduct(ProductInterface $product): void
56
    {
57
        $this->product = $product;
58
    }
59
60
    public function getVariant(): ?ProductVariantInterface
61
    {
62
        return $this->variant;
63
    }
64
65
    public function setVariant(?ProductVariantInterface $variant): void
66
    {
67
        $this->variant = $variant;
68
    }
69
70
    public function getQuantity(): int
71
    {
72
        return $this->quantity;
73
    }
74
75
    public function setQuantity(int $quantity): void
76
    {
77
        $this->quantity = $quantity;
78
    }
79
}
80