| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function __construct(\stdClass $response) |
||
| 27 | { |
||
| 28 | if (empty($response->guilds->active) && empty($response->guilds->formation)) { |
||
| 29 | throw new NotFoundException('Guilds do not exists. Are you sure server name is valid?'); |
||
| 30 | } |
||
| 31 | |||
| 32 | $active = collect(); |
||
| 33 | foreach ($response->guilds->active as $activeGuild) { |
||
| 34 | $active->push(new Guild($activeGuild->name, $activeGuild->desc, $activeGuild->guildlogo, true)); |
||
| 35 | } |
||
| 36 | |||
| 37 | $formation = collect(); |
||
| 38 | foreach ($response->guilds->formation as $inactiveGuild) { |
||
| 39 | $formation->push(new Guild($inactiveGuild->name, $inactiveGuild->desc, $inactiveGuild->guildlogo, false)); |
||
| 40 | } |
||
| 41 | |||
| 42 | $this->guilds = new Guilds($response->guilds->world, $active, $formation); |
||
| 43 | |||
| 44 | parent::__construct($response); |
||
| 45 | } |
||
| 46 | |||
| 55 |