HasBrand::SetBrand()   A
last analyzed

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 1
dl 0
loc 5
ccs 4
cts 4
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\Intangible\Brand;
10
use SignpostMarv\DaftObject\SchemaOrg\Organization;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait HasBrand
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, Brand|Organization>
19
    */
20 93
    public function GetBrand() : array
21
    {
22
        /**
23
        * @var array<int, Brand|Organization>
24
        */
25 93
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 93
            'brand',
27 93
            $this->RetrievePropertyValueFromData('brand'),
28 93
            static::class
29
        );
30
31 93
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, Brand|Organization> $value
36
    */
37 10
    public function SetBrand(array $value) : void
38
    {
39 10
        $this->NudgePropertyValue(
40 10
            'brand',
41 10
            $value
42
        );
43 10
    }
44
}
45