@param string $playBehavior

@return Play

@throws InvalidArgumentException
963636
public function setPlayBehavior($playBehavior) {
		if(!in_array($playBehavior, self::PLAY_BEHAVIORS)) {
			throw new InvalidArgumentException('PlayBehavior must be one of ' . implode(', ', self::PLAY_BEHAVIORS));
		}

		$this->playBehavior = $playBehavior;

		return $this;
	}
453494
public function getBehavior($name)
    {
        /** @var \Cake\ORM\Behavior $behavior */
        $behavior = $this->_behaviors->get($name);
        if ($behavior === null) {
            throw new InvalidArgumentException(sprintf(
                'The %s behavior is not defined on %s.',
                $name,
                get_class($this)
            ));
        }

        return $behavior;
    }
1365422
public static function playerHasNoHand(Player $player, $message = null)
    {
        $defaultMessage = sprintf('%s has not been dealt into this round', $player);
        $message = null === $message ? $defaultMessage : $message;

        return new static($message);
    }
1046522
public function setSender(ContactInterface $sender = null)
    {
        if ($sender !== null && !($sender instanceof Contact)) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s expects an instance of %s.',
                    __FUNCTION__, Contact::class
                )
            );
        }
        $this->sender = $sender;

        return $this;
    }
1086860
public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
    {
        if (!parent::has($id) && Module::$zendServiceManager) {
            return Module::$zendServiceManager->get($id);
        }

        return parent::get($id);
    }
874705
public function strategy($strategy = null)
    {
        if (is_null($strategy)) {
            $strategy = $this->defaultStrategy ?: OrderStrategy::class;
        }

        if (!class_exists($strategy)) {
            $strategy = __NAMESPACE__ . '\strategies\\' . ucfirst($strategy);
        }

        if (!class_exists($strategy)) {
            throw new InvalidArgumentException("Unsupported strategy \"{$strategy}\"");
        }

        if (empty($this->strategies[$strategy]) || !($this->strategies[$strategy] instanceof StrategyInterface)) {
            $this->strategies[$strategy] = new $strategy($this);
        }

        return $this->strategies[$strategy];
    }
901464
public function playerRaises(PlayerContract $player, Chips $chips)
    {
        $this->checkPlayerTryingToAct($player);

        $highestChipBet = $this->highestBet();
        if ($chips->amount() < $highestChipBet->amount()) {
            throw RoundException::raiseNotHighEnough($chips, $highestChipBet);
        }

        $chipStackLeft = Chips::fromAmount($player->chipStack()->amount() - $chips->amount());
        if ($chipStackLeft->amount() === 0) {
            return $this->playerPushesAllIn($player, $chips);
        }

        $betAmount = Chips::fromAmount($highestChipBet->amount() + $chips->amount());

        $this->actions->push(new Action($player, Action::RAISE, ['chips' => $betAmount]));
        $this->placeChipBet($player, $betAmount);

        $action = $chipStackLeft->amount() === 0 ? LeftToAct::ALLIN : LeftToAct::AGGRESSIVELY_ACTIONED;
        $this->leftToAct = $this->leftToAct()->playerHasActioned($player, $action);
    }
784107
public function setMaxPlays($maxPlays)
    {
        if (is_int($maxPlays) && $maxPlays >= 0) {
            $this->maxPlays = $maxPlays;
        } else {
            $msg = "The 'maxPlays' argument must be a positive (>= 0) integer, '" . gettype($maxPlays) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
632721
public function addRole($role)
    {
        if (!$role instanceof Role) {
            throw new InvalidArgumentException('addRole takes a Role object as the parameter');
        }

        if (!$this->hasRole($role->getRole())) {
            $this->roles->add($role);
        }

        return $this;
    }
360849
public function addBehavior(Behavior $behavior) {
        $behavior->setRepository($this);

        $this->_behaviors[$behavior->getAlias()] = $behavior;

        $this->attachObject($behavior->getAlias(), $behavior);

        if ($behavior instanceof Listener) {
            $this->on('db', $behavior);
        }

        return $this;
    }
660177
public function addResponse($response)
    {
        if (!($response instanceof Response)) {
            if (!is_string($response)) {
                throw new InvalidArgumentException('Invalid response');
            }
            $response = self::getMockFile($response);
        }

        $this->queue[] = $response;

        return $this;
    }
92480
protected function handleInvalidToken($tokenBehavior = self::TOKEN_BEHAVIOR_DEFAULT)
    {
        switch ($tokenBehavior) {
            case self::TOKEN_BEHAVIOR_IGNORE:
                $status = true;
                break;

            case self::TOKEN_BEHAVIOR_INVALIDATE:
                $status = false;
                break;

            case self::TOKEN_BEHAVIOR_DENY:
            default:
                // Headers ...
                $headers = [
                    'HTTP/1.0 400 Bad Request',
                    sprintf('WWW-Authenticate: x-doozr-form-service-token realm="%s"', $this->generateToken()),
                ];

                // Need to be sure to be able to send header, otherwise we need to stop operation
                if (false === headers_sent($file, $line)) {
                    foreach ($headers as $header) {
                        header($header);
                    }
                }
                exit;
                break;
        }

        return $status;
    }
488773
public static function invalidArgument($message = null)
    {
        $defaultMessage = sprintf('Invalid argument passed in GameParameters.');
        $message = null === $message ? $defaultMessage : $message;

        return new static($message);
    }
1099452
public function pushHandler($handler)
    {
        if (is_callable($handler)) {
            $handler = new CallbackHandler($handler);
        }

        if (!$handler instanceof HandlerInterface) {
            throw new InvalidArgumentException(
                  "Argument to " . __METHOD__ . " must be a callable, or instance of "
                . "Whoops\\Handler\\HandlerInterface"
            );
        }

        $this->handlerStack[] = $handler;
        return $this;
    }
436030
public function playsinline($status = false)
    {
        if($status) {
            $this->attributes['playsinline'] = true;
        } else {
            unset($this->attributes['playsinline']);
        }

        return $this;
    }
913247
public function onPlayerChat(Player $player, $text)
    {
        if ($player->getPlayerId() == 0) {
            return;
        }

        if ($player->getPlayerId() != 0 && substr($text, 0, 1) != "/") {
            if ($text === "++") {
                $this->mapRatingsService->changeRating($player->getLogin(), 1);

                return;
            }

            if ($text === "--") {
                $this->mapRatingsService->changeRating($player->getLogin(), -1);

                return;
            }
        }
    }
576551
public static function load(Persister $persister) : self
    {
        $learner = $persister->load();

        if (!$learner instanceof Learner) {
            throw new InvalidArgumentException('Peristable must be a'
                . ' learner.');
        }

        return new self($learner, $persister);
    }