Passed
Push — master ( a82c2e...a14f67 )
by SignpostMarv
12:12
created

HasMinMaxValue::SetValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
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\Intangible\StructuredValue;
10
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
11
12
trait HasMinMaxValue
13
{
14
    use DaftObjectTrait;
15
16
    /**
17
    * @return array<int, float|int>
18
    */
19 246
    public function GetMaxValue() : array
20
    {
21
        /**
22
        * @var array<int, float|int>
23
        */
24 246
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
25 246
            'maxValue',
26 246
            $this->RetrievePropertyValueFromData('maxValue'),
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

26
            $this->/** @scrutinizer ignore-call */ 
27
                   RetrievePropertyValueFromData('maxValue'),
Loading history...
27 246
            static::class
28
        );
29
30 246
        return $out;
31
    }
32
33
    /**
34
    * @param array<int, float|int> $value
35
    */
36 8
    public function SetMaxValue(array $value) : void
37
    {
38 8
        $this->NudgePropertyWithUniqueIntegersOrFloats('maxValue', __METHOD__, $value);
0 ignored issues
show
Bug introduced by
The method NudgePropertyWithUniqueIntegersOrFloats() does not exist on SignpostMarv\DaftObject\...ctTraits\HasMinMaxValue. 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

38
        $this->/** @scrutinizer ignore-call */ 
39
               NudgePropertyWithUniqueIntegersOrFloats('maxValue', __METHOD__, $value);

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...
39 8
    }
40
41
    /**
42
    * @return array<int, float|int>
43
    */
44 246
    public function GetMinValue() : array
45
    {
46
        /**
47
        * @var array<int, float|int>
48
        */
49 246
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
50 246
            'minValue',
51 246
            $this->RetrievePropertyValueFromData('minValue'),
52 246
            static::class
53
        );
54
55 246
        return $out;
56
    }
57
58
    /**
59
    * @param array<int, float|int> $value
60
    */
61 8
    public function SetMinValue(array $value) : void
62
    {
63 8
        $this->NudgePropertyWithUniqueIntegersOrFloats('minValue', __METHOD__, $value);
64 8
    }
65
66
    /**
67
    * @return array<int, bool|string|int|float|StructuredValue>
68
    */
69 246
    public function GetValue() : array
70
    {
71
        /**
72
        * @var array<int, bool|string|int|float|StructuredValue>
73
        */
74 246
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
75 246
            'value',
76 246
            $this->RetrievePropertyValueFromData('value'),
77 246
            static::class
78
        );
79
80 246
        return $out;
81
    }
82
83
    /**
84
    * @param array<int, bool|string|int|float|StructuredValue> $value
85
    */
86 8
    public function SetValue(array $value) : void
87
    {
88 8
        $this->NudgePropertyValue('value', $value, true);
89 8
    }
90
}
91