Last active
August 30, 2019 13:26
-
-
Save BinaryKitten/828d1e1b63084234c38c3adb4f86b768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Player { | |
public function __construct() | |
{ | |
$this->drawPile = new Collection(); | |
$this->drawPile->whenEmpty(function ($collection) { | |
return $this->recycleDiscardPile(); | |
}) | |
} | |
public function draw(int $numberOfCards): void | |
{ | |
$this->hand = $this->drawPile->splice(0, $numberOfCards); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment