Jyxo\Input\Validator\StringLengthBetween::setMax PHP Method

setMax() public method

Sets the maximal string length.
public setMax ( integer $max ) : self
$max integer Maximal string length
return self
    public function setMax(int $max) : self
    {
        if ($max <= 0) {
            throw new \InvalidArgumentException('Length of string must be greater than zero.');
        }
        if ($this->min !== null && $max < $this->min) {
            throw new \InvalidArgumentException('Min length must be lower or equal to max length.');
        }
        $this->max = $max;
        return $this;
    }