Conditions | 3 |
Paths | 3 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function __construct(\stdClass $response) |
||
27 | { |
||
28 | if (isset($response->highscores->data->error)) { |
||
29 | throw new NotFoundException('World does not exists.'); |
||
30 | } |
||
31 | |||
32 | $highscores = collect(); |
||
33 | foreach ($response->highscores->data as $highscore) { |
||
34 | $highscores->push(new Character( |
||
35 | $highscore->name, |
||
36 | $highscore->rank, |
||
37 | $highscore->vocation, |
||
38 | $highscore->points ?? null, |
||
39 | $highscore->level ?? null |
||
40 | )); |
||
41 | } |
||
42 | |||
43 | $this->highscores = new Highscores( |
||
44 | $response->highscores->filters->world, |
||
45 | $response->highscores->filters->category, |
||
46 | $highscores |
||
47 | ); |
||
48 | |||
49 | parent::__construct($response); |
||
50 | } |
||
51 | |||
60 |