src/Entity/PlayTrait.php
public function play(PlayerId $playerId, Move $move)
    {
        $playMethod = 'play' . $this->getClassName($move);

        if (! method_exists($this, $playMethod)) {
            throw new IllegalMoveException($move, 'Error: move was not recognized!');
        }

        return $this->$playMethod($playerId, $move);
    }
public function play(PlayerId $playerId, Move $move)
    {
        $playMethod = 'play' . $this->getClassName($move);

        if (! method_exists($this, $playMethod)) {
            throw new IllegalMoveException($move, 'Error: move was not recognized!');
        }

        return $this->$playMethod($playerId, $move);
    }
public function play ( PlayerId $ playerId , Move $ move ) { $ playMethod = 'play' . $ this -> getClassName ( $ move ) ; if ( ! method_exists ( $ this , $ playMethod ) ) { throw new IllegalMoveException ( $ move , 'Error: move was not recognized!' ) ; } return $ this -> $ playMethod ( $ playerId , $ move ) ; }
Allows the player to play the game

@param  PlayerId $playerId
@param  Move $move

@throws IllegalMoveException

@return GameResult
Allows the player to play the game