Passed
Push — master ( 439e24...8d28ce )
by SignpostMarv
11:20
created

HasMember   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SetMember() 0 6 1
A GetMember() 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\Organization;
10
use SignpostMarv\DaftObject\SchemaOrg\Person;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait HasMember
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, Organization|Person>
19
    */
20 79
    public function GetMember() : array
21
    {
22
        /**
23
        * @var array<int, Organization|Person>
24
        */
25 79
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 79
            'member',
27 79
            $this->RetrievePropertyValueFromData('member'),
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('member'),
Loading history...
28 79
            static::class
29
        );
30
31 79
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, Organization|Person> $value
36
    */
37 4
    public function SetMember(array $value) : void
38
    {
39 4
        $this->NudgePropertyWithUniqueOrganizationsOrPersons(
0 ignored issues
show
Bug introduced by
The method NudgePropertyWithUniqueOrganizationsOrPersons() does not exist on SignpostMarv\DaftObject\...tObjectTraits\HasMember. Did you maybe mean NudgePropertyWithUniqueValuesOfThings()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        $this->/** @scrutinizer ignore-call */ 
40
               NudgePropertyWithUniqueOrganizationsOrPersons(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40 4
            'member',
41 4
            __METHOD__,
42 4
            $value
43
        );
44 4
    }
45
}
46