public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (null != $this->validator && false != $this->validator) {
                $validator = $this->validator;
                $valids = array();
                $all_valid = true;
                $pieces = explode(',', $this->user_value);
                foreach ($pieces as $piece) {
                    $result = $validator::quickValidate($piece, $this->constraints);
                    if (null !== $result) {
                        $valids[] = $result;
                    } else {
                        $all_valid = false;
                    }
                }
                $this->user_value = implode(',', $valids);
                $this->is_valid = $all_valid;
                if (!$all_valid) {
                    $this->error = 'The provided value is not valid. Please enter a valid value.';
                }
            } else {
                // This field does not get validated
                $this->is_valid = true;
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (null != $this->validator && false != $this->validator) {
                $validator = $this->validator;
                $valids = array();
                $all_valid = true;
                $pieces = explode(',', $this->user_value);
                foreach ($pieces as $piece) {
                    $result = $validator::quickValidate($piece, $this->constraints);
                    if (null !== $result) {
                        $valids[] = $result;
                    } else {
                        $all_valid = false;
                    }
                }
                $this->user_value = implode(',', $valids);
                $this->is_valid = $all_valid;
                if (!$all_valid) {
                    $this->error = 'The provided value is not valid. Please enter a valid value.';
                }
            } else {
                // This field does not get validated
                $this->is_valid = true;
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
public function validate ( ) : void { if ( null === $ this -> is_valid ) { if ( null === $ this -> user_value && null !== $ this -> default_value ) { // There is a preset value, and its not being changed $ this -> is_valid = true ; } elseif ( null != $ this -> validator && false != $ this -> validator ) { $ validator = $ this -> validator ; $ valids = array ( ) ; $ all_valid = true ; $ pieces = explode ( ',' , $ this -> user_value ) ; foreach ( $ pieces as $ piece ) { $ result = $ validator :: quickValidate ( $ piece , $ this -> constraints ) ; if ( null !== $ result ) { $ valids [ ] = $ result ; } else { $ all_valid = false ; } } $ this -> user_value = implode ( ',' , $ valids ) ; $ this -> is_valid = $ all_valid ; if ( ! $ all_valid ) { $ this -> error = 'The provided value is not valid. Please enter a valid value.' ; } } else { // This field does not get validated $ this -> is_valid = true ; } } // Check if the input is different from the default value if ( $ this -> is_valid && null !== $ this -> user_value ) { $ this -> is_changed = ( $ this -> default_value != $ this -> user_value ) ; } }
Validates the user value according to the validator defined for this element.
Validates the user value according to the validator defined for this element .