Passed
Push — master ( 6d0f47...81601f )
by SignpostMarv
12:06
created

HasAreaServed::GetAreaServed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 12
ccs 6
cts 6
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\GeoShape;
10
use SignpostMarv\DaftObject\SchemaOrg\Place;
11
use SignpostMarv\DaftObject\SchemaOrg\Place\AdministrativeArea;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
trait HasAreaServed
15
{
16
    use DaftObjectTrait;
17
18
    /**
19
    * @return array<int, string|AdministrativeArea|GeoShape|Place>
20
    */
21 111
    public function GetAreaServed() : array
22
    {
23
        /**
24
        * @var array<int, string|AdministrativeArea|GeoShape|Place>
25
        */
26 111
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
27 111
            'areaServed',
28 111
            $this->RetrievePropertyValueFromData('areaServed'),
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('areaServed'),
Loading history...
29 111
            static::class
30
        );
31
32 111
        return $out;
33
    }
34
35
    /**
36
    * @param array<int, string|AdministrativeArea|GeoShape|Place> $value
37
    */
38 9
    public function SetAreaServed(array $value) : void
39
    {
40 9
        $this->NudgePropertyWithUniqueTrimmedStringsOrThings(
0 ignored issues
show
Bug introduced by
The method NudgePropertyWithUniqueTrimmedStringsOrThings() does not exist on SignpostMarv\DaftObject\...ectTraits\HasAreaServed. 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

40
        $this->/** @scrutinizer ignore-call */ 
41
               NudgePropertyWithUniqueTrimmedStringsOrThings(

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...
41 9
            'areaServed',
42 9
            __METHOD__,
43 9
            $value,
44 9
            AdministrativeArea::class,
45 9
            GeoShape::class,
46 9
            Place::class
47
        );
48 9
    }
49
}
50