HasUnitCodeText::SetUnitCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Thing;
10
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
11
12
trait HasUnitCodeText
13
{
14
    use DaftObjectTrait;
15
16
    /**
17
    * @return array<int, string>
18
    */
19 150
    public function GetUnitCode() : array
20
    {
21
        /**
22
        * @var array<int, string>
23
        */
24 150
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
25 150
            'unitCode',
26 150
            $this->RetrievePropertyValueFromData('unitCode'),
27 150
            static::class
28
        );
29
30 150
        return $out;
31
    }
32
33
    /**
34
    * @param array<int, string> $value
35
    */
36 6
    public function SetUnitCode(array $value) : void
37
    {
38 6
        $this->NudgePropertyValue(
39 6
            'unitCode',
40 6
            $value,
41 6
            Thing::BOOL_DEFAULT_AUTOTRIMSTRINGS
42
        );
43 6
    }
44
45
    /**
46
    * @return array<int, string>
47
    */
48 150
    public function GetUnitText() : array
49
    {
50
        /**
51
        * @var array<int, string>
52
        */
53 150
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
54 150
            'unitText',
55 150
            $this->RetrievePropertyValueFromData('unitText'),
56 150
            static::class
57
        );
58
59 150
        return $out;
60
    }
61
62
    /**
63
    * @param array<int, string> $value
64
    */
65 6
    public function SetUnitText(array $value) : void
66
    {
67 6
        $this->NudgePropertyValue(
68 6
            'unitText',
69 6
            $value,
70 6
            Thing::BOOL_DEFAULT_AUTOTRIMSTRINGS
71
        );
72 6
    }
73
}
74