Passed
Push — master ( 532413...392df2 )
by Kylian
01:24
created

BeatMapVersionDifficultyParitySummary   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getErrors() 0 3 1
A toJson() 0 3 1
A getResets() 0 3 1
A toArray() 0 3 1
A getWarns() 0 3 1
1
<?php
2
3
namespace KriKrixs\object\beatmap;
4
5
class BeatMapVersionDifficultyParitySummary
6
{
7
    private object $paritySummary;
8
9
    /**
10
     * Create a new BeatMapVersionDifficultyParitySummary object
11
     * @param object $paritySummary
12
     */
13
    public function __construct(object $paritySummary)
14
    {
15
        $this->paritySummary = $paritySummary;
16
    }
17
18
    /**
19
     * Return raw data
20
     * @return object
21
     */
22
    public function toJson(): object
23
    {
24
        return $this->paritySummary;
25
    }
26
27
    /**
28
     * Return array data
29
     * @return array
30
     */
31
    public function toArray(): array
32
    {
33
        return json_decode($this->paritySummary, true);
0 ignored issues
show
Bug introduced by
$this->paritySummary of type object is incompatible with the type string expected by parameter $json of json_decode(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
        return json_decode(/** @scrutinizer ignore-type */ $this->paritySummary, true);
Loading history...
34
    }
35
36
    /**
37
     * Get map version difficulty parity summary errors
38
     * @return int
39
     */
40
    public function getErrors(): int
41
    {
42
        return $this->paritySummary->errors;
43
    }
44
45
    /**
46
     * Get map version difficulty parity summary resets
47
     * @return int
48
     */
49
    public function getResets(): int
50
    {
51
        return $this->paritySummary->resets;
52
    }
53
54
    /**
55
     * Get map version difficulty parity summary warns
56
     * @return int
57
     */
58
    public function getWarns(): int
59
    {
60
        return $this->paritySummary->warns;
61
    }
62
}