Slackwolf\Game\Command\LeaveCommand::__construct PHP 메소드

__construct() 공개 메소드

Constructs a new Leave command.
public __construct ( RealTimeClient $client, GameManager $gameManager, Message $message, array $args = null )
$client Slack\RealTimeClient
$gameManager Slackwolf\Game\GameManager
$message Slackwolf\Message\Message
$args array
    public function __construct(RealTimeClient $client, GameManager $gameManager, Message $message, array $args = null)
    {
        parent::__construct($client, $gameManager, $message, $args);
        if ($this->channel[0] == 'D') {
            throw new Exception("Can't leave a game or lobby by direct message.");
        }
        if (!$this->game) {
            throw new Exception("No game in progress.");
        }
        if ($this->game->getState() != GameState::LOBBY) {
            throw new Exception("Game in progress is not in lobby state.");
        }
    }