ResponseMaps   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 10
c 4
b 0
f 0
dl 0
loc 39
rs 10
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBeatMaps() 0 3 1
A setBeatMaps() 0 4 1
A setRawBeatMaps() 0 10 4
1
<?php
2
3
namespace KriKrixs\object\response;
4
5
use KriKrixs\object\beatmap\BeatMap;
6
7
class ResponseMaps extends Response
8
{
9
    private array $beatMaps = [];
10
11
    /**
12
     * Get beatmaps (array of BeatMap object)
13
     * @return array
14
     */
15
    public function getBeatMaps(): array
16
    {
17
        return $this->beatMaps;
18
    }
19
20
    /**
21
     * Set beatmaps
22
     * @param array $beatMaps
23
     * @return ResponseMaps
24
     */
25
    public function setBeatMaps(array $beatMaps): ResponseMaps
26
    {
27
        $this->beatMaps = $beatMaps;
28
        return $this;
29
    }
30
31
    /**
32
     * Set raw beatmaps
33
     * @param object $rawBeatMaps
34
     * @return ResponseMaps
35
     */
36
    public function setRawBeatMaps(object $rawBeatMaps): ResponseMaps
37
    {
38
        $beatMaps = [];
39
40
        foreach ($rawBeatMaps as $hash => $rawBeatMap) {
41
            $beatMaps[$hash] = $rawBeatMap === null || gettype($rawBeatMap) !== "object" ? null : new BeatMap($rawBeatMap);
42
        }
43
44
        $this->beatMaps = $beatMaps;
45
        return $this;
46
    }
47
}