You are here

public function Question::setMaxAttempts in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Question/Question.php \Symfony\Component\Console\Question\Question::setMaxAttempts()

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

Parameters

null|int $attempts:

Return value

Question The current instance

Throws

\InvalidArgumentException In case the number of attempts is invalid.

File

vendor/symfony/console/Question/Question.php, line 192

Class

Question
Represents a Question.

Namespace

Symfony\Component\Console\Question

Code

public function setMaxAttempts($attempts) {
  if (null !== $attempts && $attempts < 1) {
    throw new \InvalidArgumentException('Maximum number of attempts must be a positive value.');
  }
  $this->attempts = $attempts;
  return $this;
}