function getCircleClass(Game $game) { if ($game->score1 == $game->score2) { return 'draw'; } elseif ($game->score1 < $game->score2 && $game->isHome()) { return 'loose'; } elseif ($game->score1 > $game->score2 && !$game->isHome()) { return 'loose'; } return 'win'; }
private function parseStats(Game $game, Htmldom $html) { $table = $html->find('table.season-list', 0); if (!$table) { $this->error('No stats table for game ' . $game->id); return null; } $stats = []; $team_class = $game->isHome() ? 'home_event' : 'away_event'; foreach ($table->find('tr') as $row) { $statRow = $row->find('td.' . $team_class, 0); if ($statRow) { array_push($stats, $this->parseAndDetermineStat($statRow)); } } return $stats; }