Passed
Push — master ( df1a48...669ccb )
by SignpostMarv
04:37
created

HasSku   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 54.55%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 28
ccs 6
cts 11
cp 0.5455
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SetSku() 0 6 1
A GetSku() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
8
9
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
10
11
trait HasSku
12
{
13
    /**
14
    * @return array<int, string>
15
    */
16 5
    public function GetSku() : array
17
    {
18
        /**
19
        * @var array<int, string>
20
        */
21 5
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
22 5
            'sku',
23 5
            $this->RetrievePropertyValueFromData('sku'),
0 ignored issues
show
Bug introduced by
It seems like RetrievePropertyValueFromData() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

23
            $this->/** @scrutinizer ignore-call */ 
24
                   RetrievePropertyValueFromData('sku'),
Loading history...
24 5
            static::class
25
        );
26
27 5
        return $out;
28
    }
29
30
    /**
31
    * @param array<int, string> $value
32
    */
33
    public function SetSku(array $value) : void
34
    {
35
        $this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString(
0 ignored issues
show
Bug introduced by
It seems like NudgePropertyWithUniqueT...ringsMightNotBeString() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

35
        $this->/** @scrutinizer ignore-call */ 
36
               NudgePropertyWithUniqueTrimmedStringsMightNotBeString(
Loading history...
36
            'sku',
37
            __METHOD__,
38
            $value
39
        );
40
    }
41
}
42