Passed
Branch fuzzy-generators (9f9b2f)
by SignpostMarv
11:06
created

AggregateRating::SetReviewCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
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\Intangible\Rating;
8
9
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Rating as Base;
11
use SignpostMarv\DaftObject\SchemaOrg\Thing;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
/**
15
* @property array<int, Thing> $itemReviewed
16
* @property array<int, int> $ratingCount
17
* @property array<int, int> $reviewCount
18
*/
19
class AggregateRating extends Base
20
{
21
    use DaftObjectTraits\HasItemReviewed;
22
23
    const SCHEMA_ORG_TYPE = 'AggregateRating';
24
25
    const PROPERTIES = [
26
        'itemReviewed',
27
        'ratingCount',
28
        'reviewCount',
29
    ];
30
31
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
32
        'itemReviewed' => TypeUtilities::MULTI_TYPE_DICT__itemReviewed,
33
        'ratingCount' => [
34
            'integer',
35
        ],
36
        'reviewCount' => [
37
            'integer',
38
        ],
39
    ];
40
41
    /**
42
    * @return array<int, int>
43
    */
44 65
    public function GetRatingCount() : array
45
    {
46
        /**
47
        * @var array<int, int>
48
        */
49 65
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
50 65
            'ratingCount',
51 65
            $this->RetrievePropertyValueFromData('ratingCount'),
52 65
            static::class
53
        );
54
55 65
        return $out;
56
    }
57
58
    /**
59
    * @param array<int, int> $value
60
    */
61 1
    public function SetRatingCount(array $value) : void
62
    {
63 1
        $this->NudgePropertyWithUniqueIntegers(
64 1
            'ratingCount',
65 1
            __METHOD__,
66 1
            $value
67
        );
68 1
    }
69
70
    /**
71
    * @return array<int, int>
72
    */
73 65
    public function GetReviewCount() : array
74
    {
75
        /**
76
        * @var array<int, int>
77
        */
78 65
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
79 65
            'reviewCount',
80 65
            $this->RetrievePropertyValueFromData('reviewCount'),
81 65
            static::class
82
        );
83
84 65
        return $out;
85
    }
86
87
    /**
88
    * @param array<int, int> $value
89
    */
90 1
    public function SetReviewCount(array $value) : void
91
    {
92 1
        $this->NudgePropertyWithUniqueIntegers(
93 1
            'reviewCount',
94 1
            __METHOD__,
95 1
            $value
96
        );
97 1
    }
98
}
99