Ejemplo n.º 1
0
 /**
  * @return team[]
  */
 public function load()
 {
     $request = new Request(self::TEAMS_STEAM_URL, array('start_at_team_id' => $this->getTeamId(), 'teams_requested' => $this->getTeamsRequested()));
     $teamsInfo = $request->send();
     if (null === $teamsInfo) {
         return null;
     }
     $teams = array();
     if (isset($teamsInfo->teams)) {
         $teamsInfo = (array) $teamsInfo->teams;
         $teamsInfo = $teamsInfo['team'];
         if (is_array($teamsInfo)) {
             foreach ($teamsInfo as $teamInfo) {
                 $team = $this->getTeam($teamInfo);
                 $teams[$team->get('team_id')] = $team;
             }
             return $teams;
         } else {
             $team = $this->getTeam($teamsInfo);
             $teams[$team->get('team_id')] = $team;
             return $teams;
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * @return array
  */
 public function load()
 {
     $request = new Request(self::STEAM_MATCHES_URL, $this->_getDataArray());
     $xml = $request->send();
     if (null === $xml) {
         return null;
     }
     $matches = array();
     if (isset($xml->matches)) {
         $this->_total_results = $xml->total_results;
         $this->_results_remaining = $xml->results_remaining;
         foreach ($xml->matches as $m_matches) {
             foreach ($m_matches as $m) {
                 $match = new Match();
                 $match->setArray((array) $m);
                 foreach ($m->players as $players) {
                     foreach ($players as $player) {
                         $slot = new Slot();
                         $slot->setArray((array) $player);
                         $match->addSlot($slot);
                     }
                 }
                 $matches[$match->get('match_id')] = $match;
             }
         }
     }
     return $matches;
 }
Ejemplo n.º 3
0
 /**
  * @param int $ugcid
  * @return object | null
  */
 public function load($ugcid = null)
 {
     if (null !== $ugcid) {
         $this->_ugcid = $ugcid;
     }
     $request = new Request(self::STEAM_UGC_URL, array('appid' => 570, 'ugcid' => $this->_ugcid));
     return $request->send();
 }
 public function load()
 {
     $request = new Request(self::LEAGUES_PRIZE_POOL_STEAM_URL, array('leagueid' => $this->getLeagueId()));
     $prizePool = $request->send();
     if (null === $prizePool) {
         return null;
     }
     return (array) $prizePool;
 }
Ejemplo n.º 5
0
 /**
  * @return array
  */
 public function load()
 {
     $request = new Request(self::HEROES_STEAM_URL, array());
     $response = $request->send();
     if (null === $response) {
         return null;
     }
     $heroes_info = (array) $response->heroes;
     $heroes_info = $heroes_info['hero'];
     $heroes = array();
     foreach ($heroes_info as $hero_info) {
         $info = (array) $hero_info;
         $heroes[$info['id']] = $info;
     }
     return $heroes;
 }
Ejemplo n.º 6
0
 /**
  *
  */
 public function load()
 {
     $request = new Request(self::LEAGUE_STEAM_URL, array('league_id' => $this->getLeagueId()));
     $leagueLiveMatches = $request->send();
     if (null === $leagueLiveMatches) {
         return null;
     }
     $leagueLiveMatches = $leagueLiveMatches->games;
     $liveMatches = array();
     if (null === $leagueLiveMatches->game) {
         return array();
     }
     foreach ($leagueLiveMatches->game as $game) {
         $liveMatch = new LiveMatch();
         foreach ($game->players->player as $player) {
             switch ($player->team) {
                 case 0:
                     $liveMatch->addRadiantPlayer((array) $player);
                     break;
                 case 1:
                     $liveMatch->addDirePlayer((array) $player);
                     break;
                 case 2:
                     $liveMatch->addBroadcaster((array) $player);
                     break;
                 case 4:
                     $liveMatch->addUnassigned((array) $player);
                     break;
             }
         }
         $a_game = (array) $game;
         unset($a_game['players']);
         $a_game['radiant_team_id'] = (string) $a_game['radiant_team']->team_id;
         $a_game['radiant_name'] = (string) $a_game['radiant_team']->team_name;
         $a_game['radiant_logo'] = (string) $a_game['radiant_team']->team_logo;
         $a_game['radiant_team_complete'] = $a_game['radiant_team']->complete === 'false' ? 0 : 1;
         $a_game['dire_team_id'] = (string) $a_game['dire_team']->team_id;
         $a_game['dire_name'] = (string) $a_game['dire_team']->team_name;
         $a_game['dire_logo'] = (string) $a_game['dire_team']->team_logo;
         $a_game['dire_team_complete'] = $a_game['dire_team']->complete === 'false' ? 0 : 1;
         unset($a_game['dire_team'], $a_game['radiant_team']);
         $liveMatch->setArray($a_game);
         array_push($liveMatches, $liveMatch);
     }
     return $liveMatches;
 }
Ejemplo n.º 7
0
 /**
  * @return array
  */
 public function load()
 {
     $request = new Request(self::LEAGUES_STEAM_URL, array());
     $response = $request->send();
     if (null === $response) {
         return null;
     }
     $leaguesInfo = (array) $response->leagues;
     $leaguesInfo = $leaguesInfo['league'];
     $leagues = array();
     foreach ($leaguesInfo as $leagueInfo) {
         $info = (array) $leagueInfo;
         array_walk($info, function (&$v) {
             $v = (string) $v;
         });
         $league = new League();
         $league->setArray($info);
         $leagues[$info['leagueid']] = $league;
     }
     return $leagues;
 }
Ejemplo n.º 8
0
 /**
  * @return Item[]
  */
 public function load()
 {
     $request = new Request(self::ITEMS_STEAM_URL, array());
     $response = $request->send();
     if (null === $response) {
         return null;
     }
     $itemsInfo = (array) $response->items;
     $itemsInfo = $itemsInfo['item'];
     $items = array();
     foreach ($itemsInfo as $itemInfo) {
         $info = (array) $itemInfo;
         array_walk($info, function (&$v) {
             $v = (string) $v;
         });
         $item = new item();
         $item->setArray($info);
         $items[$info['id']] = $item;
     }
     return $items;
 }
Ejemplo n.º 9
0
 /**
  * @return Player[]
  */
 public function load()
 {
     $request = new Request(self::PLAYER_STEAM_URL, array('steamids' => $this->getIdsString()));
     $playersInfo = $request->send();
     if (null === $playersInfo) {
         return null;
     }
     $players = array();
     foreach ($playersInfo->players[0] as $playerInfo) {
         $player = new Player();
         $player->setArray((array) $playerInfo);
         $players[$player->get('steamid')] = $player;
     }
     return $players;
 }