protected function setMaxLength(Field & $field, $length)
    {
        if (($value = intval($length)) > 0) {
            $field->validationRules[] = sprintf('max:%s', $value);
            $field->methodParams[] = $value;
        }

        return $this;
    }
protected function setMaxLength(Field & $field, $length)
    {
        if (($value = intval($length)) > 0) {
            $field->validationRules[] = sprintf('max:%s', $value);
            $field->methodParams[] = $value;
        }

        return $this;
    }
protected function setMaxLength ( Field & $ field , $ length ) { if ( ( $ value = intval ( $ length ) ) > 0 ) { $ field -> validationRules [ ] = sprintf ( 'max:%s' , $ value ) ; $ field -> methodParams [ ] = $ value ; } return $ this ; }
Set the max length for a given field.

@param CrestApps\CodeGenerator\Models\Field $field
@param string $length

@return $this
Set the max length for a given field .