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

PageFactory::defaultOps()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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