示例#1
0
 public static function getHotWithDetails()
 {
     $urlBGG = BGGUrls::getHot();
     $arrayRawGamesHot = self::getBGGUrl($urlBGG);
     $arrayHotGames = [];
     foreach ($arrayRawGamesHot['item'] as $game) {
         $arrayHotGames[$game['@attributes']['id']] = ['name' => $game['name']['@attributes']['value']];
     }
     $arrayHotGamesDetails = BGGData::getDetailOfGames($arrayHotGames);
     foreach ($arrayHotGamesDetails as $gameId => $gameDetail) {
         $arrayHotGames[$gameId]['id'] = $gameId;
         foreach ($gameDetail['link'] as $link) {
             $attributes = $link['@attributes'];
             $label = $attributes['value'];
             $arrayHotGames[$gameId]['detail'][$attributes['type']][] = ['value' => $label, 'id' => $attributes['id']];
         }
     }
     return $arrayHotGames;
 }