} foreach (scandir($ranked_path) as $file) { if ('.' === $file) { continue; } if ('..' === $file) { continue; } $region = strtolower(basename($file, ".json")); $region_matches = json_decode(file_get_contents($ranked_path . "/" . $file), true); $total_matches = count($region_matches); $pos = 0; //Initialize API wrapper $api = new riotapi($region, $api_key); //Begin the calls, yo try { foreach ($region_matches as $match_id) { $m = $api->getMatch($match_id, 'includeTimeline=true'); if (isset($m["timeline"])) { $matches->insert($m); printf("inserted match " . $pos . " / " . $total_matches . " for " . $region . " ranked\n"); } else { printf("Missing timeline: match " . $pos . " / " . $total_matches . "\n"); } $pos++; } } catch (Exception $e) { echo "Error: " . $e->getMessage(); } } }
// $summoner_id = 585897; $test = new riotapi('na', '8d44fc30-4ef3-4a8e-8aae-a6b124e37f21'); // $testCache = new riotapi('na', new FileSystemCache('cache/')); //$r = $test->getSummonerByName($summoner_name); //$r = $test->getSummoner($summoner_id); //$r = $test->getSummoner($summoner_id,'masteries'); //$r = $test->getSummoner($summoner_id,'runes'); //$r = $test->getSummoner($summoner_id,'name'); //$r = $test->getStats($summoner_id); //$r = $test->getStats($summoner_id,'ranked'); //$r = $test->getTeam($summoner_id); //$r = $test->getLeague($summoner_id); //$r = $test->getGame($summoner_id); //$r = $test->getChampion(); try { for ($i = 0; $i < 1; $i++) { // $r = $test->getSummonerByName($summoner_name); $r = $test->getMatch('1900737137', 'includeTimeline=true'); print_r($r); print_r($i); } } catch (Exception $e) { echo "Error: " . $e->getMessage(); } // echo "<br>\r\n testing cache:"; // try { // $r = $testCache->getSummoner($summoner_id); // print_r($r); // } catch(Exception $e) { // echo "Error: " . $e->getMessage(); // };