Themosis\Validation\ValidationBuilder::parseRule PHP Method

parseRule() protected method

Parse validation rule and return an array containing the rule and its attributes.
protected parseRule ( string $rule ) : array
$rule string The validation rule to parse.
return array
    protected function parseRule($rule)
    {
        $properties = ['rule' => '', 'attributes' => []];
        // Check if attributes are defined...
        if (0 < strpos($rule, ':')) {
            $extract = explode(':', $rule);
            // The rule
            $properties['rule'] = $extract[0];
            // The attributes
            $properties['attributes'] = $this->getAttributes($extract[1]);
        } else {
            // No attributes, simply defined the rule.
            // Leave attributes as empty array.
            $properties['rule'] = $rule;
        }
        return $properties;
    }