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

AbstractFeatureItemFactory::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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