Test Failed
Push — master ( 4486b3...16bdc1 )
by SignpostMarv
02:20
created

PricePriceCurrency   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 57
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A SetPriceCurrency() 0 5 1
A SetPrice() 0 5 1
A GetPrice() 0 12 1
A GetPriceCurrency() 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\TypeUtilities;
10
11
trait PricePriceCurrency
12
{
13
    use DaftObjectTrait;
14
15
    /**
16
    * @return array<int, int|string>
17
    */
18
    public function GetPrice() : array
19
    {
20
        /**
21
        * @var array<int, int|string>
22
        */
23
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
24
            'price',
25
            $this->RetrievePropertyValueFromData('price'),
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

25
            $this->/** @scrutinizer ignore-call */ 
26
                   RetrievePropertyValueFromData('price'),
Loading history...
26
            static::class
27
        );
28
29
        return $out;
30
    }
31
32
    /**
33
    * @param array<int, int|string> $value
34
    */
35
    public function SetPrice(array $value) : void
36
    {
37
        $this->NudgePropertyValue(
38
            'price',
39
            $value
40
        );
41
    }
42
43
    /**
44
    * @return array<int, string>
45
    */
46
    public function GetPriceCurrency() : array
47
    {
48
        /**
49
        * @var array<int, string>
50
        */
51
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
52
            'priceCurrency',
53
            $this->RetrievePropertyValueFromData('priceCurrency'),
54
            static::class
55
        );
56
57
        return $out;
58
    }
59
60
    /**
61
    * @param array<int, string> $value
62
    */
63
    public function SetPriceCurrency(array $value) : void
64
    {
65
        $this->NudgePropertyValue(
66
            'priceCurrency',
67
            $value
68
        );
69
    }
70
}
71