for ($i = 0; $i < $numplayers + 2; $i++) { $playableCards[] = $this->guilds[$i]; } } foreach ($this->cards as $card) { if ($card->getNumPlayers() <= $numplayers and $card->getAge() == $age) { $playableCards[] = $card; } } shuffle($playableCards); foreach ($players as $player) { $player->hand = array_splice($playableCards, 0, 7); } } public function import() { $this->importAge(1); $this->importAge(2); $this->importAge(3); } private function importAge($age) { $lines = explode("\r", file_get_contents("cards/age{$age}.csv")); foreach ($lines as $line) { $this->addCards(Card::import($age, str_getcsv($line))); } } } $deck = new Deck(); $deck->import();