public function updateMatches() { Log::notice("Matches updated at " . date("Y-m-d H:i:s", time())); $this->updateResultType(10); /* * Iterates over all matches, creates them if not present, updates if still open */ foreach ($this->matches as $key => $match_json) { $teams = $this->findOrCreateTeams($match_json); $match = Match::findOrNew($match_json['match']); // If match doesn't exist, or is not closed yet if (!$match || !$match['closed']) { $this->populateMatch($match, $match_json, $teams); } } }