ResponseMaps::getBeatMaps()   A
last analyzed

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
}