Passed
Push — master ( f71194...439e24 )
by SignpostMarv
11:18
created

HasMemberOf::SetMemberOf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
ccs 7
cts 7
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\ProgramMembership;
10
use SignpostMarv\DaftObject\SchemaOrg\Organization;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait HasMemberOf
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, Organization|ProgramMembership>
19
    */
20 72
    public function GetMemberOf() : array
21
    {
22
        /**
23
        * @var array<int, Organization|ProgramMembership>
24
        */
25 72
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 72
            'memberOf',
27 72
            $this->RetrievePropertyValueFromData('memberOf'),
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

27
            $this->/** @scrutinizer ignore-call */ 
28
                   RetrievePropertyValueFromData('memberOf'),
Loading history...
28 72
            static::class
29
        );
30
31 72
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, Organization|ProgramMembership> $value
36
    */
37 1
    public function SetMemberOf(array $value) : void
38
    {
39 1
        $this->NudgePropertyWithUniqueValuesOfThings(
40 1
            'memberOf',
41 1
            __METHOD__,
42 1
            $value,
43 1
            Organization::class,
44 1
            ProgramMembership::class
45
        );
46 1
    }
47
}
48