Completed
Push — master ( 5ac7a7...b21de6 )
by Matthias
9s
created

ProductBundle   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 97
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getCode() 0 4 1
A setCode() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getProduct() 0 4 1
A setProduct() 0 4 1
A addSlot() 0 4 1
A getSlots() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SolutionDrive\SyliusProductBundlesPlugin\Entity;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Sylius\Component\Core\Model\ProductInterface;
10
use Sylius\Component\Resource\Model\CodeAwareInterface;
11
use Sylius\Component\Resource\Model\ResourceInterface;
12
13
class ProductBundle implements ProductBundleInterface, ResourceInterface, CodeAwareInterface
14
{
15
    /** @var int */
16
    private $id;
17
18
    /** @var string|null */
19
    private $code;
20
21
    /** @var string */
22
    private $name;
23
24
    /** @var ProductBundleSlotInterface[]|Collection|ArrayCollection */
25
    private $slots;
26
27
    /** @var ProductInterface */
28
    private $product;
29
30
    /**
31
     * ProductBundle constructor.
32
     */
33
    public function __construct()
34
    {
35
        $this->slots = new ArrayCollection();
36
    }
37
38
    /**
39
     * @return int
40
     */
41
    public function getId(): int
42
    {
43
        return $this->id;
44
    }
45
46
    /**
47
     * @return string|null
48
     */
49
    public function getCode(): ?string
50
    {
51
        return $this->code;
52
    }
53
54
    /**
55
     * @param string|null $code
56
     */
57
    public function setCode(?string $code): void
58
    {
59
        $this->code = $code;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getName(): ?string
66
    {
67
        return $this->name;
68
    }
69
70
    /**
71
     * @param string $name
72
     */
73
    public function setName(?string $name): void
74
    {
75
        $this->name = $name;
76
    }
77
78
    /**
79
     * @param ProductBundleSlotInterface $slot
80
     */
81
    public function addSlot(ProductBundleSlotInterface $slot): void
82
    {
83
        $this->slots->add($slot);
84
    }
85
86
    /**
87
     * @return ProductBundleSlotInterface[]|Collection|ArrayCollection
88
     */
89
    public function getSlots(): Collection
90
    {
91
        return $this->slots;
92
    }
93
94
    /**
95
     * @return ProductInterface
96
     */
97
    public function getProduct(): ProductInterface
98
    {
99
        return $this->product;
100
    }
101
102
    /**
103
     * @param ProductInterface $product
104
     */
105
    public function setProduct(ProductInterface $product): void
106
    {
107
        $this->product = $product;
108
    }
109
}
110