Passed
Push — develop ( 53a66f...07e04a )
by Daniel
05:35
created

AbstractFeatureItemFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultOps() 0 7 1
A init() 0 5 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Factory\Entity\Component\Feature;
4
5
use Silverback\ApiComponentBundle\Entity\Component\AbstractComponent;
6
use Silverback\ApiComponentBundle\Entity\Component\Feature\FeatureItemInterface;
7
use Silverback\ApiComponentBundle\Factory\Entity\Component\AbstractComponentFactory;
8
9
abstract class AbstractFeatureItemFactory extends AbstractComponentFactory
10
{
11
    /**
12
     * @param FeatureItemInterface $component
13
     * @inheritdoc
14
     */
15 4
    protected function init(AbstractComponent $component, ?array $ops = null): void
16
    {
17 4
        parent::init($component, $ops);
18 4
        $component->setLabel($this->ops['label']);
0 ignored issues
show
Bug introduced by
The method setLabel() does not exist on Silverback\ApiComponentB...onent\AbstractComponent. It seems like you code against a sub-type of Silverback\ApiComponentB...onent\AbstractComponent such as Silverback\ApiComponentB...ure\AbstractFeatureItem. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $component->/** @scrutinizer ignore-call */ 
19
                    setLabel($this->ops['label']);
Loading history...
19 4
        $component->setLink($this->ops['link']);
0 ignored issues
show
Bug introduced by
The method setLink() does not exist on Silverback\ApiComponentB...onent\AbstractComponent. It seems like you code against a sub-type of Silverback\ApiComponentB...onent\AbstractComponent such as Silverback\ApiComponentB...ure\AbstractFeatureItem. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        $component->/** @scrutinizer ignore-call */ 
20
                    setLink($this->ops['link']);
Loading history...
20 4
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25 8
    public static function defaultOps(): array
26
    {
27 8
        return array_merge(
28 8
            parent::defaultOps(),
29
            [
30 8
                'label' => '',
31
                'link' => null
32
            ]
33
        );
34
    }
35
}
36