Passed
Push — develop ( 4ccf1b...14897c )
by Daniel
04:51
created

GalleryFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getItemFactory() 0 3 1
A create() 0 6 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Factory\Entity\Content\Component\Gallery;
4
5
use Doctrine\Common\Persistence\ObjectManager;
6
use Silverback\ApiComponentBundle\Entity\Content\Component\Gallery\Gallery;
7
use Silverback\ApiComponentBundle\Factory\Entity\Content\Component\AbstractComponentFactory;
8
use Symfony\Component\Validator\Validator\ValidatorInterface;
9
10
/**
11
 * @author Daniel West <[email protected]>
12
 */
13
final class GalleryFactory extends AbstractComponentFactory
14
{
15
    /** @var GalleryItemFactory  */
16
    private $itemFactory;
17
18 3
    public function __construct(ObjectManager $manager, ValidatorInterface $validator, GalleryItemFactory $itemFactory)
19
    {
20 3
        $this->itemFactory = $itemFactory;
21 3
        parent::__construct($manager, $validator);
22 3
    }
23
24
    public function getItemFactory()
25
    {
26
        return $this->itemFactory;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32 2
    public function create(?array $ops = null): Gallery
33
    {
34 2
        $component = new Gallery();
35 2
        $this->init($component, $ops);
36 2
        $this->validate($component);
37 2
        return $component;
38
    }
39
}
40