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

createNewWithValues()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 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