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

ProductBundleSlot::getProducts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\ResourceInterface;
11
12
/**
13
 * Created by solutionDrive GmbH.
14
 *
15
 * @copyright 2018 solutionDrive GmbH
16
 */
17
class ProductBundleSlot implements ProductBundleSlotInterface, ResourceInterface
18
{
19
    /** @var int */
20
    private $id;
21
22
    /** @var string */
23
    private $name = '';
24
25
    /** @var int */
26
    private $position = 0;
27
28
    /** @var ProductBundleInterface */
29
    private $bundle;
30
31
    /** @var ProductInterface[]|Collection|ArrayCollection */
32
    private $products;
33
34
    public function __construct()
35
    {
36
        $this->products = new ArrayCollection();
37
    }
38
39
    public function getId(): int
40
    {
41
        return $this->id;
42
    }
43
44
    public function getName(): string
45
    {
46
        return $this->name;
47
    }
48
49
    public function setName(string $name): void
50
    {
51
        $this->name = $name;
52
    }
53
54
    public function getPosition(): int
55
    {
56
        return $this->position;
57
    }
58
59
    public function setPosition(int $position): void
60
    {
61
        $this->position = $position;
62
    }
63
64
    public function getBundle(): ?ProductBundleInterface
65
    {
66
        return $this->bundle;
67
    }
68
69
    public function setBundle(ProductBundleInterface $bundle): void
70
    {
71
        $this->bundle = $bundle;
72
    }
73
74
    public function getProducts(): Collection
75
    {
76
        return $this->products;
77
    }
78
79
    public function addProduct(ProductInterface $product): void
80
    {
81
        $this->products->add($product);
82
    }
83
}
84