BeatMapStats   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 74
rs 10
c 1
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 3 1
A getUpvotesNumber() 0 3 1
A getPlaysNumber() 0 3 1
A getDownloadsNumber() 0 3 1
A toJson() 0 3 1
A getVotesRatio() 0 3 1
A getDownvotesNumber() 0 3 1
1
<?php
2
3
namespace KriKrixs\object\beatmap;
4
5
class BeatMapStats
6
{
7
    private object $stats;
8
9
    /**
10
     * Create a new BeatMapStats object
11
     * @param object $stats
12
     */
13
    public function __construct(object $stats)
14
    {
15
        $this->stats = $stats;
16
    }
17
18
    /**
19
     * Return raw data
20
     * @return object
21
     */
22
    public function toJson(): object
23
    {
24
        return $this->stats;
25
    }
26
27
    /**
28
     * Return array data
29
     * @return array
30
     */
31
    public function toArray(): array
32
    {
33
        return json_decode(json_encode($this->stats), true);
34
    }
35
36
    /**
37
     * Get map plays number
38
     * @return int
39
     */
40
    public function getPlaysNumber(): int
41
    {
42
        return $this->stats->plays;
43
    }
44
45
    /**
46
     * Get map download number
47
     * @return int
48
     */
49
    public function getDownloadsNumber(): int
50
    {
51
        return $this->stats->downloads;
52
    }
53
54
    /**
55
     * Get map upvotes number
56
     * @return int
57
     */
58
    public function getUpvotesNumber(): int
59
    {
60
        return $this->stats->upvotes;
61
    }
62
63
    /**
64
     * Get map downvotes number
65
     * @return int
66
     */
67
    public function getDownvotesNumber(): int
68
    {
69
        return $this->stats->downvotes;
70
    }
71
72
    /**
73
     * Get votes ratio
74
     * @return int
75
     */
76
    public function getVotesRatio(): float
77
    {
78
        return $this->stats->score;
79
    }
80
}