Passed
Push — master ( 461a97...e7ae09 )
by SignpostMarv
02:31
created

HasUnitCodeText   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 59
ccs 0
cts 32
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A GetUnitCode() 0 12 1
A SetUnitCode() 0 6 1
A GetUnitText() 0 12 1
A SetUnitText() 0 6 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 HasUnitCodeText
12
{
13
    use DaftObjectTrait;
14
15
    /**
16
    * @return array<int, string>
17
    */
18
    public function GetUnitCode() : array
19
    {
20
        /**
21
        * @var array<int, string>
22
        */
23
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
24
            'unitCode',
25
            $this->RetrievePropertyValueFromData('unitCode'),
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

25
            $this->/** @scrutinizer ignore-call */ 
26
                   RetrievePropertyValueFromData('unitCode'),
Loading history...
26
            static::class
27
        );
28
29
        return $out;
30
    }
31
32
    /**
33
    * @param array<int, string> $value
34
    */
35
    public function SetUnitCode(array $value) : void
36
    {
37
        $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

37
        $this->/** @scrutinizer ignore-call */ 
38
               NudgePropertyWithUniqueTrimmedStringsMightNotBeString(
Loading history...
38
            'unitCode',
39
            __METHOD__,
40
            $value
41
        );
42
    }
43
44
    /**
45
    * @return array<int, string>
46
    */
47
    public function GetUnitText() : array
48
    {
49
        /**
50
        * @var array<int, string>
51
        */
52
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
53
            'unitText',
54
            $this->RetrievePropertyValueFromData('unitText'),
55
            static::class
56
        );
57
58
        return $out;
59
    }
60
61
    /**
62
    * @param array<int, string> $value
63
    */
64
    public function SetUnitText(array $value) : void
65
    {
66
        $this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString(
67
            'unitText',
68
            __METHOD__,
69
            $value
70
        );
71
    }
72
}
73