Passed
Push — develop ( 96281a...e6f82b )
by Daniel
05:53 queued 26s
created

PageFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 27
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultOps() 0 3 1
A create() 0 6 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Factory\Entity\Content;
4
5
use Silverback\ApiComponentBundle\Entity\Content\Page\Page;
6
use Silverback\ApiComponentBundle\Factory\Entity\AbstractFactory;
7
8
class PageFactory extends AbstractFactory
9
{
10
    public const PAGE_OPS = [
11
        'title' => 'New Page',
12
        'metaDescription' => null,
13
        'parent' => null,
14
        'layout' => null,
15
        'route' => null
16
    ];
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function create(?array $ops = null): Page
22
    {
23
        $component = new Page();
24
        $this->init($component, $ops);
25
        $this->validate($component);
26
        return $component;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    protected static function defaultOps(): array
33
    {
34
        return self::PAGE_OPS;
35
    }
36
}
37