Passed
Push — develop ( 06ad9c...85b5fc )
by Daniel
05:05
created

FeatureStackedFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Factory\Entity\Content\Component\Feature\Stacked;
4
5
use Doctrine\Common\Persistence\ObjectManager;
6
use Silverback\ApiComponentBundle\Entity\Content\Component\Feature\Stacked\FeatureStacked;
7
use Silverback\ApiComponentBundle\Factory\Entity\Content\Component\AbstractComponentFactory;
8
use Symfony\Component\Validator\Validator\ValidatorInterface;
9
10
class FeatureStackedFactory extends AbstractComponentFactory
11
{
12
    /** @var FeatureStackedItemFactory  */
13
    private $itemFactory;
14
15 3
    public function __construct(ObjectManager $manager, ValidatorInterface $validator, FeatureStackedItemFactory $itemFactory)
16
    {
17 3
        $this->itemFactory = $itemFactory;
18 3
        parent::__construct($manager, $validator);
19 3
    }
20
21
    public function getItemFactory()
22
    {
23
        return $this->itemFactory;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29 2
    public function create(?array $ops = null): FeatureStacked
30
    {
31 2
        $component = new FeatureStacked();
32 2
        $this->init($component, $ops);
33 2
        $this->validate($component);
34 2
        return $component;
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40 3
    public static function defaultOps(): array
41
    {
42 3
        return array_merge(
43 3
            parent::defaultOps(),
44
            [
45 3
                'reverse' => false
46
            ]
47
        );
48
    }
49
}
50