Passed
Push — master ( 77331f...637ad2 )
by SignpostMarv
03:51
created

TraitSupersededBy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 33
ccs 6
cts 14
cp 0.4286
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SetSupersededBy() 0 9 1
A GetSupersededBy() 0 12 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\Intangible\Enumeration;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\IntangibleClass;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\IntangibleProperty;
12
use SignpostMarv\DaftObject\TypeUtilities;
13
14
trait TraitSupersededBy
15
{
16
    use DaftObjectTrait;
17
18
    /**
19
    * @return array<int, IntangibleClass|Enumeration|IntangibleProperty>
20
    */
21 4
    public function GetSupersededBy() : array
22
    {
23
        /**
24
        * @var array<int, IntangibleClass|Enumeration|IntangibleProperty>
25
        */
26 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
27 4
            'supersededBy',
28 4
            $this->RetrievePropertyValueFromData('supersededBy'),
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

28
            $this->/** @scrutinizer ignore-call */ 
29
                   RetrievePropertyValueFromData('supersededBy'),
Loading history...
29 4
            static::class
30
        );
31
32 4
        return $out;
33
    }
34
35
    /**
36
    * @param array<int, IntangibleClass|Enumeration|IntangibleProperty> $value
37
    */
38
    public function SetSupersededBy(array $value) : void
39
    {
40
        $this->NudgePropertyWithUniqueValuesOfThings(
41
            'supersededBy',
42
            __METHOD__,
43
            $value,
44
            IntangibleClass::class,
45
            Enumeration::class,
46
            IntangibleProperty::class
47
        );
48
    }
49
}
50