Passed
Push — master ( df1a48...669ccb )
by SignpostMarv
04:37
created

UpDownVoteCount   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 59
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A GetUpvoteCount() 0 12 1
A SetUpvoteCount() 0 6 1
A GetDownvoteCount() 0 12 1
A SetDownvoteCount() 0 6 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 UpDownVoteCount
12
{
13
    use DaftObjectTrait;
14
15
    /**
16
    * @return array<int, int>
17
    */
18 13
    public function GetDownvoteCount() : array
19
    {
20
        /**
21
        * @var array<int, int>
22
        */
23 13
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
24 13
            'downvoteCount',
25 13
            $this->RetrievePropertyValueFromData('downvoteCount'),
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('downvoteCount'),
Loading history...
26 13
            static::class
27
        );
28
29 13
        return $out;
30
    }
31
32
    /**
33
    * @param array<int, int> $value
34
    */
35 5
    public function SetDownvoteCount(array $value) : void
36
    {
37 5
        $this->NudgePropertyWithUniqueIntegers(
0 ignored issues
show
Bug introduced by
The method NudgePropertyWithUniqueIntegers() does not exist on SignpostMarv\DaftObject\...tTraits\UpDownVoteCount. 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

37
        $this->/** @scrutinizer ignore-call */ 
38
               NudgePropertyWithUniqueIntegers(

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...
38 5
            'downvoteCount',
39 5
            __METHOD__,
40 5
            $value
41
        );
42 5
    }
43
44
    /**
45
    * @return array<int, int>
46
    */
47 13
    public function GetUpvoteCount() : array
48
    {
49
        /**
50
        * @var array<int, int>
51
        */
52 13
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
53 13
            'upvoteCount',
54 13
            $this->RetrievePropertyValueFromData('upvoteCount'),
55 13
            static::class
56
        );
57
58 13
        return $out;
59
    }
60
61
    /**
62
    * @param array<int, int> $value
63
    */
64 5
    public function SetUpvoteCount(array $value) : void
65
    {
66 5
        $this->NudgePropertyWithUniqueIntegers(
67 5
            'upvoteCount',
68 5
            __METHOD__,
69 5
            $value
70
        );
71 5
    }
72
}
73