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;
    }
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;
    }
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 ; }
Sets the maximum number of attempts.

Null means an unlimited number of attempts.

@param int|null $attempts

@return $this

@throws InvalidArgumentException in case the number of attempts is invalid
Sets the maximum number of attempts .