/** * @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; }
/** * @param League $league */ public function insert(League $league) { $db = Db::obtain(); $db->insertPDO(Db::realTablename('leagues'), $league->getDataArray()); }