SilverWare\Validator\Rules\MinLengthRule
An extension of the min rule class for a minlength rule.
- Author: Colin Tucker <colin@praxis.net.au>
- Copyright: 2017 Praxis Interactive
- License: https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
Synopsis
class MinLengthRule
extends MinRule
{
- // members
- private static string $default_type = 'minlength';
- // Inherited members from MinRule
- protected $min;
- // Inherited members from Rule
- protected $type;
- protected FormField $field;
- protected $format;
- protected $message;
- protected Validator $validator;
- protected string|array $attribute;
- // methods
- public boolean test()
- public string getDefaultMessage()
- // Inherited methods from MinRule
- public void __construct()
- public $this setMin()
- public float getMin()
- public boolean isValid()
- public boolean test()
- public string getDefaultMessage()
- // Inherited methods from Rule
- public void __construct()
- public abstract boolean test()
- public $this setType()
- public string getType()
- public string getDefaultType()
- public boolean hasType()
- public $this setFormat()
- public string getFormat()
- public boolean hasFormat()
- public string getDefaultFormat()
- public $this setAttribute()
- public string getAttribute()
- public string getValue()
- public string getFormattedValue()
- public $this setField()
- public FormField getField()
- public string getFieldName()
- public Form getForm()
- public FieldList getFormFields()
- public FormField getDataField()
- public $this setMessage()
- public string getMessage()
- public boolean hasMessage()
- public string getDefaultMessage()
- public $this setValidator()
- public Validator getValidator()
- public array getAttributes()
- public boolean isValid()
- public string replaceTokens()
- protected Backend backend()
- protected string attr()
- protected array getTokenNames()
- protected mixed getTokenValue()
Hierarchy
Members
private
- $default_type
—
string
Defines the default type for the rule.
protected
- $attribute
—
SilverWare\Validator\string|array
The name of the data attribute used for this rule. - $field
—
SilverStripe\Forms\FormField
The form field instance associated with this rule. - $format
—
string
A tokenised string which defines the format for the validator attribute. - $message
—
string
The message displayed to the user when the rule test fails. - $min
—
float
The minimum value allowed. - $type
—
string
A string which defines the rule type. - $validator
—
SilverWare\Validator\Validator
The form validator instance associated with this rule.
Methods
public
- getDefaultMessage() — Answers the default message for the rule.
- test() — Answers the test result of the validator rule on the given value.
Inherited from SilverWare\Validator\Rules\MinRule
public
- getDefaultMessage() — Answers the default message for the rule.
- getMin() — Answers the value of the min attribute.
- isValid() — Answers true if the rule is valid for use with the validator.
- setMin() — Defines the value of the min attribute.
- test() — Answers the test result of the validator rule on the given value.
Inherited from SilverWare\Validator\Rule
protected
- attr() — Answers the appropriate validator attribute name for the given mapping name and arguments.
- backend() — Answers the validator backend.
- getTokenNames() — Answers an array of the token names found within the given string.
- getTokenValue() — Answers the value of the given token name.
public
- getAttribute() — Answers the name used by the rule for the form field attribute.
- getAttributes() — Answers the validator attributes for the associated form field.
- getDataField() — Answers a data field with the specified name.
- getDefaultFormat() — Answers the default format for the receiver.
- getDefaultMessage() — Answers the default message for the rule.
- getDefaultType() — Answers the default type for the receiver.
- getField() — Answers the value of the field attribute.
- getFieldName() — Answers the name of the associated form field.
- getForm() — Answers the form instance from the associated field.
- getFormFields() — Answers the list of fields from the associated form.
- getFormat() — Answers the value of the format attribute.
- getFormattedValue() — Answers the formatted value for the rule attribute.
- getMessage() — Answers the value of the message attribute.
- getType() — Answers the value of the type attribute.
- getValidator() — Answers the value of the validator attribute.
- getValue() — Answers the value of the rule attribute.
- hasFormat() — Answers true if the receiver has a format defined.
- hasMessage() — Answers true if the receiver has a message defined.
- hasType() — Answers true if the receiver has a type defined.
- isValid() — Answers true if the rule is valid for use with the validator.
- replaceTokens() — Replaces identified tokens within the given string.
- setAttribute() — Defines the name(s) used by the rule for the form field attribute.
- setField() — Defines the value of the field attribute.
- setFormat() — Defines the value of the format attribute.
- setMessage() — Defines the value of the message attribute.
- setType() — Defines the value of the type attribute.
- setValidator() — Defines the value of the validator attribute.
- test() — Answers the test result of the rule on the given value.