Statistics::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
crap 1
1
<?php
2
3
namespace NekoAPI\Component\Entity;
4
5
/**
6
 * Class Statistics
7
 *
8
 * @package NekoAPI\Component\Entity
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class Statistics extends BaseEntity
12
{
13
    /**
14
     * @var Score
15
     */
16
    private $score;
17
18
    /**
19
     * @var int
20
     */
21
    private $ranked;
22
23
    /**
24
     * @var int
25
     */
26
    private $popularity;
27
28
    /**
29
     * @var int
30
     */
31
    private $members;
32
33
    /**
34
     * @var int
35
     */
36
    private $favorites;
37
38
    /**
39
     * @return Score
40
     */
41 2
    public function getScore(): ?Score
42
    {
43 2
        return $this->score;
44
    }
45
46
    /**
47
     * @param Score $score
48
     *
49
     * @return Statistics
50
     */
51 2
    public function setScore(Score $score): Statistics
52
    {
53 2
        $this->score = $score;
54
55 2
        return $this;
56
    }
57
58
    /**
59
     * @return int
60
     */
61 2
    public function getRanked(): ?int
62
    {
63 2
        return $this->ranked;
64
    }
65
66
    /**
67
     * @param int $ranked
68
     *
69
     * @return Statistics
70
     */
71 2
    public function setRanked(int $ranked): Statistics
72
    {
73 2
        $this->ranked = $ranked;
74
75 2
        return $this;
76
    }
77
78
    /**
79
     * @return int
80
     */
81 2
    public function getPopularity(): ?int
82
    {
83 2
        return $this->popularity;
84
    }
85
86
    /**
87
     * @param int $popularity
88
     *
89
     * @return Statistics
90
     */
91 2
    public function setPopularity(int $popularity): Statistics
92
    {
93 2
        $this->popularity = $popularity;
94
95 2
        return $this;
96
    }
97
98
    /**
99
     * @return int
100
     */
101 2
    public function getMembers(): ?int
102
    {
103 2
        return $this->members;
104
    }
105
106
    /**
107
     * @param int $members
108
     *
109
     * @return Statistics
110
     */
111 2
    public function setMembers(int $members): Statistics
112
    {
113 2
        $this->members = $members;
114
115 2
        return $this;
116
    }
117
118
    /**
119
     * @return int
120
     */
121 2
    public function getFavorites(): ?int
122
    {
123 2
        return $this->favorites;
124
    }
125
126
    /**
127
     * @param int $favorites
128
     *
129
     * @return Statistics
130
     */
131 2
    public function setFavorites(int $favorites): Statistics
132
    {
133 2
        $this->favorites = $favorites;
134
135 2
        return $this;
136
    }
137
138
    /**
139
     * @inheritDoc
140
     */
141 1
    public function jsonSerialize(): array
142
    {
143
        return [
144 1
            'score'      => $this->getScore(),
145 1
            'ranked'     => $this->getRanked(),
146 1
            'popularity' => $this->getPopularity(),
147 1
            'members'    => $this->getMembers(),
148 1
            'favorites'  => $this->getFavorites(),
149
        ];
150
    }
151
152
153
}