/** * When $winPlayer win round, it is collect all cards which are situated on GameTable * * @param Player $winPlayer */ protected function collectCardsByWinnerPlayer(Player $winPlayer) { $winCardsCollection = new CardCollection(); foreach ($this->getPlayers() as $player) { $winCardsCollection->appendMany($this->gameTable->getPlayerCards($player)->collectAll()); } $winCardsCollection->setAllVisible(false); $winCardsCollection->shuffle(); $winPlayer->getCards()->prependMany($winCardsCollection->collectAll()); }
public function testSetAllVisible() { $cardCollection = new CardCollection(TestDataProvider::getCardsArray()); $cardCollection->setAllVisible(true); foreach ($cardCollection->getAll() as $card) { $this->assertTrue($card->isVisible()); } $cardCollection->setAllVisible(false); foreach ($cardCollection->getAll() as $card) { $this->assertFalse($card->isVisible()); } }