} if ('..' === $file) { continue; } $region = strtolower(basename($file, ".json")); $region_matches = json_decode(file_get_contents($norms_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"])) { $m_clean = parseMatch($m, $MAJOR_ITEMS); $matches->insert($m_clean); printf("inserted match " . $pos . " / " . $total_matches . " for " . $region . " norms\n"); } else { printf("Missing timeline: match " . $pos . " / " . $total_matches . "\n"); } $pos++; } } catch (Exception $e) { echo "Error: " . $e->getMessage(); } } foreach (scandir($ranked_path) as $file) { if ('.' === $file) { continue; }
function parseExpression($ast) { $type = ast_node_type($ast); switch ($type) { case NodeType::LITERAL: $ret = parseLiteral($ast); break; case NodeType::ATTRIBUTE: $ret = parseAttributeExpr($ast); break; case NodeType::FUNC: $ret = parseFunction($ast); break; case Nodetype::METHOD: $ret = parseMethod($ast); break; case NodeType::OPERATOR: $ret = parseOperator($ast); break; case NodeType::CASE_NODE: $ret = parseCase($ast); break; case NodeType::MATCH: $ret = parseMatch($ast); break; case NodeType::NUL: $ret = parseNull($ast); break; default: $source = ast_node_source($ast); grokit_logic_error('Attempted to evaluate node of type ' . $type . ' as an expression ' . $source); } return $ret; }