Total Complexity | 7 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | trait ProductsAwareTrait |
||
12 | { |
||
13 | /** @var Collection|BrandAwareInterface[]|ProductInterface[] */ |
||
14 | protected $products; |
||
15 | |||
16 | /** |
||
17 | * {@inheritdoc} |
||
18 | */ |
||
19 | public function initializeProductsCollection(): void |
||
20 | { |
||
21 | $this->products = new ArrayCollection(); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function getProducts(): Collection |
||
28 | { |
||
29 | return $this->products; |
||
|
|||
30 | } |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function hasProduct(BrandAwareInterface $product): bool |
||
36 | { |
||
37 | return $this->products->contains($product); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function addProduct(BrandAwareInterface $product): void |
||
49 | } |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function removeProduct(BrandAwareInterface $product): void |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 |