Exemplo n.º 1
0
 /**
  * @param            $json
  * @param HypixelPHP $api
  */
 public function __construct($json, $api)
 {
     parent::__construct(['record' => $json], $api);
     $list = ["GUILDMASTER" => [], "OFFICER" => [], "MEMBER" => []];
     $this->count = sizeof($json);
     foreach ($json as $player) {
         $rank = $player['rank'];
         if (!in_array($rank, array_keys($list))) {
             $list[$rank] = [];
         }
         $coinHistory = [];
         foreach ($player as $key => $val) {
             if (strpos($key, 'dailyCoins') !== false) {
                 $EXPLOSION = explode('-', $key);
                 $coinHistory[$EXPLOSION[1] . '-' . ($EXPLOSION[2] + 1) . '-' . $EXPLOSION[3]] = $val;
                 unset($player[$key]);
             }
         }
         $player['coinHistory'] = $coinHistory;
         array_push($list[$rank], new GuildMember($player, $api));
     }
     $this->list = $list;
 }