Passed
Pull Request — master (#1)
by
unknown
02:45
created

HistogramRating::getOneStar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nelexa\GPlay\Model;
5
6
class HistogramRating
7
{
8
    /**
9
     * @var int
10
     */
11
    private $fiveStars;
12
    /**
13
     * @var int
14
     */
15
    private $fourStars;
16
    /**
17
     * @var int
18
     */
19
    private $threeStars;
20
    /**
21
     * @var int
22
     */
23
    private $twoStars;
24
    /**
25
     * @var int
26
     */
27
    private $oneStar;
28
29
    /**
30
     * HistogramRating constructor.
31
     *
32
     * @param int $fiveStars
33
     * @param int $fourStars
34
     * @param int $threeStars
35
     * @param int $twoStars
36
     * @param int $oneStar
37
     */
38
    public function __construct(int $fiveStars, int $fourStars, int $threeStars, int $twoStars, int $oneStar)
39
    {
40
        $this->fiveStars = $fiveStars;
41
        $this->fourStars = $fourStars;
42
        $this->threeStars = $threeStars;
43
        $this->twoStars = $twoStars;
44
        $this->oneStar = $oneStar;
45
    }
46
47
    /**
48
     * @return int
49
     */
50
    public function getFiveStars(): int
51
    {
52
        return $this->fiveStars;
53
    }
54
55
    /**
56
     * @return int
57
     */
58
    public function getFourStars(): int
59
    {
60
        return $this->fourStars;
61
    }
62
63
    /**
64
     * @return int
65
     */
66
    public function getThreeStars(): int
67
    {
68
        return $this->threeStars;
69
    }
70
71
    /**
72
     * @return int
73
     */
74
    public function getTwoStars(): int
75
    {
76
        return $this->twoStars;
77
    }
78
79
    /**
80
     * @return int
81
     */
82
    public function getOneStar(): int
83
    {
84
        return $this->oneStar;
85
    }
86
87
    /**
88
     * @return string
89
     */
90
    public function __toString()
91
    {
92
        return sprintf(
93
            "⭐⭐⭐⭐⭐ %d\n⭐⭐⭐⭐  %d\n⭐⭐⭐   %d\n⭐⭐    %d\n⭐     %d",
94
            $this->fiveStars,
95
            $this->fourStars,
96
            $this->threeStars,
97
            $this->twoStars,
98
            $this->oneStar
99
        );
100
    }
101
}
102