Completed
Pull Request — master (#22)
by Matthias
03:17
created

ProductBundleSlotOptionsFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createNew() 0 4 1
A createNewWithValues() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace solutionDrive\SyliusProductBundlesPlugin\Factory;
6
7
use solutionDrive\SyliusProductBundlesPlugin\Service\Options\ProductBundleSlotOptions;
8
use solutionDrive\SyliusProductBundlesPlugin\Service\Options\ProductBundleSlotOptionsInterface;
9
10
class ProductBundleSlotOptionsFactory implements ProductBundleSlotOptionsFactoryInterface
11
{
12
    public function createNew(): ProductBundleSlotOptionsInterface
13
    {
14
        return new ProductBundleSlotOptions();
15
    }
16
17
    public function createNewWithValues(
18
        int $position,
19
        bool $isPresentationSlot = false
20
    ): ProductBundleSlotOptionsInterface
21
    {
22
        $productBundleSlotOptions = $this->createNew();
23
        $productBundleSlotOptions->setPosition($position);
24
        if($isPresentationSlot) {
25
            $productBundleSlotOptions->isPresentationSlot();
26
        }
27
        return $productBundleSlotOptions;
28
    }
29
}
30