protected function seasonFromRow($row, $season = null) { $stats = $this->cleanRow($row); if (!$season) { if ($this->output) { print_r("No Existing Season, Creating New Season\n"); } $season = new Season(); } $season->setGames($stats[4]); $season->setAtBats($stats[5]); $season->setRuns($stats[6]); $season->setHits($stats[7]); $season->setDoubles($stats[9]); $season->setTriples($stats[10]); $season->setHomeRuns($stats[11]); $season->setTotalBases($stats[12]); $season->setRunsBattedIn($stats[14]); $season->setStolenBases($stats[15]); $season->setStolenBaseAttempts($stats[16]); $season->setWalks($stats[17]); $season->setStrikeouts($stats[18]); $season->setHitByPitch($stats[19]); $season->setSacrificeHits($stats[20]); $season->setSacrificeFlies($stats[21]); $season->setAppearances($stats[22]); $season->setGamesStarted($stats[23]); $season->setCompleteGames($stats[24]); $season->setWins($stats[25]); $season->setLosses($stats[26]); $season->setSaves($stats[27]); $season->setShutouts($stats[28]); $season->setInningsPitched($stats[29]); $season->setHitsAllowed($stats[30]); $season->setRunsAllowed($stats[31]); $season->setEarnedRuns($stats[32]); $season->setWalksAllowed($stats[33]); $season->setStrikeoutsPitched($stats[34]); $year = explode('-', $stats[2]); $year = date('Y', strtotime("january 1, " . $year[1])); $season->setYear($year); return $season; }