Passed
Branch fuzzy-generators (db6188)
by SignpostMarv
06:43
created

HasHasPart::SetIsPartOf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 2
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\CreativeWork;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Trip;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait HasHasPart
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, CreativeWork|Trip>
19
    */
20 71
    public function GetHasPart() : array
21
    {
22
        /**
23
        * @var array<int, CreativeWork|Trip>
24
        */
25 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 71
            'hasPart',
27 71
            $this->RetrievePropertyValueFromData('hasPart'),
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('hasPart'),
Loading history...
28 71
            static::class
29
        );
30
31 71
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, CreativeWork|Trip> $value
36
    */
37 28
    public function SetHasPart(array $value) : void
38
    {
39 28
        $this->NudgePropertyWithUniqueValuesOfThings(
40 28
            'hasPart',
41 28
            __METHOD__,
42 28
            $value,
43 28
            CreativeWork::class,
44 28
            Trip::class
45
        );
46 28
    }
47
48
    /**
49
    * @return array<int, CreativeWork|Trip>
50
    */
51 43
    public function GetIsPartOf() : array
52
    {
53
        /**
54
        * @var array<int, CreativeWork|Trip>
55
        */
56 43
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
57 43
            'isPartOf',
58 43
            $this->RetrievePropertyValueFromData('isPartOf'),
59 43
            static::class
60
        );
61
62 43
        return $out;
63
    }
64
65
    /**
66
    * @param array<int, CreativeWork|Trip> $value
67
    */
68
    public function SetIsPartOf(array $value) : void
69
    {
70
        $this->NudgePropertyWithUniqueValuesOfThings(
71
            'isPartOf',
72
            __METHOD__,
73
            $value,
74
            CreativeWork::class,
75
            Trip::class
76
        );
77
    }
78
}
79