Validate the form controls, validates by the required status, and some specific control validations
such as email control
@return \bootbuilder\Validation\ValidationResult
550788
public function validate() {
        $status = new ValidationResult();

        // Check if the form is loaded
        if (!$this->form instanceof \bootbuilder\Form) {
            $status->setError(true);
            return $status;
        }

        // Validate form controls (and panes)
        foreach ($this->form->getRawControls() as $nr => $control) {
            if(!$this->validateControl($control, $status)) {
                $status->setError(true);
                $control->setErrorState(true);
            }
            
            $this->form->replaceControl($nr, $control);
        }
        
        return $status;
    }
967644
public function validate()
    {
        $value = $this->getValue();
        // Check if the element is required
        if (($this->required) && empty($value)) {
            $this->errors[] = 'This field is required.';
        }
        // Check field validators
        if (count($this->validators) > 0) {
            foreach ($this->validators as $validator) {
                if ($validator instanceof \Pop\Validator\ValidatorInterface) {
                    if (!$validator->evaluate($value)) {
                        if (!in_array($validator->getMessage(), $this->errors)) {
                            $this->errors[] = $validator->getMessage();
                        }
                    }
                } else if (is_callable($validator)) {
                    $result = call_user_func_array($validator, [$value]);
                    if (null !== $result) {
                        if (!in_array($result, $this->errors)) {
                            $this->errors[] = $result;
                        }
                    }
                }
            }
        }
        return (count($this->errors) == 0);
    }
163610
public function validate() {

		$parent = $this->getParent();

		// The URL segment will conflict with a year/month/day/media format when numeric.

		if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) {

			// Customise a validation error message.

			if(is_numeric($this->URLSegment)) {
				$message = '"URL Segment" must not be numeric!';
			}
			else if(!($parent instanceof MediaHolder)) {
				$message = 'The parent needs to be a published media holder!';
			}
			else {
				$message = "The media holder type doesn't match this!";
			}
			$error = new HTTPResponse_Exception($message, 403);
			$error->getResponse()->addHeader('X-Status', rawurlencode($message));

			// Allow extension customisation.

			$this->extend('validateMediaPage', $error);
			throw $error;
		}
		return parent::validate();
	}
685599
protected function validate(){
		$valid = true;
		$message = null;
		$result = ValidationResult::create($valid, $message);
		return $result;
	}
501389
protected function getValidatorInstance()
    {
        $this->setupValidationScenario();
        $this->setupValidationParameters();

        $this->validationFactory = $this->container->make(ValidationContract::class);
        $this->validationDispatcher = $this->container->make(DispatcherContract::class);

        return $this->runValidation($this->all(), [], $this->messages());
    }
1051908
public function validateAction()
    {
        // Check for a valid POST request
        if (!$this->getRequest()->isPost()) {
            // Return a "405 Method Not Allowed" response
            $this->getResponse()->setHttpResponseCode(405);
            return;
        }

        $data = $this->getRequest()->getPost();

        // Check that all of the required fields are present
        if (empty($data) || !isset($data['country_id'], $data['region_id'], $data['street'], $data['city'], $data['postcode'])) {
            // Return a "400 Bad Request" response
            $this->getResponse()->setHttpResponseCode(400);
            return;
        }

        $country = Mage::getModel('directory/country')->load($data['country_id'])->getName();
        $region = Mage::getModel('directory/region')->load($data['region_id'])->getCode();

        $result = Mage::helper('australia/address')->validate(
            $data['street'],
            $region,
            $data['city'],
            $data['postcode'],
            $country
        );

        $this->getResponse()->setHeader('Content-type', 'application/json');
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
    }
293829
public function validate()
    {
        /** @var ValidationResult $validation */
        $validation = parent::validate();
        if (!$validation->isValid()) {
            return $validation;
        }

        $blog = $this->Blog();
        if (!$blog || !$blog->exists()) {
            return $validation;
        }

        if ($this->getDuplicatesByField('Title')->count() > 0) {
            $validation->addError($this->getDuplicateError(), self::DUPLICATE_EXCEPTION);
        }

        return $validation;
    }
1130812
protected function validateEmail()
    {
        $field = 'email';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('E-mail');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        return true;
    }
1040409
public function validate()
    {
        $this->resetResult();
        if ($this->getEnabled()) {
            $this->php($this->form->getData());
        }
        return $this->result;
    }
52668
public function validate() {
        $validated = TRUE;

        foreach($this->getFormElements() as $name => $child) {
            $validated &= $child->validate();
        }

        $validated &= $this->fireEvent("Form\onValidate", [ $this->value, $this ], TRUE, FALSE);

        return (bool)$validated;
    }
719404
public function validate()
	{
		foreach ($this->validators as $validate)
		{
			$definition = $this->klass->getStaticPropertyValue($validate);
			$this->$validate(wrap_strings_in_arrays($definition));
		}

		$model_reflection = Reflections::instance()->get($this->model);

		if ($model_reflection->hasMethod('validate') && $model_reflection->getMethod('validate')->isPublic())
			$this->model->validate();

		$this->record->clear_model();
		return $this->record;
	}
129772
public function doValidate()
    {
        $isValid = true;
        if ($this->props['validate']) {
            $isValid = \call_user_func($this->props['validate'], $this);
        }
        return $isValid;
    }
937440
public function validation()
    {

        $validator = new Validation();

        $validator->add('name', new PresenceOf([
            'message' => 'User type name must be supplied'
        ]));

        $validator->add('name', new Uniqueness([
            'message' => 'Sorry, the user type already exists'
        ]));

        return $this->validate($validator);
    }
491426
private function bootValidators()
    {
        Validator::extend('enum_key', function($attribute, $value, $parameters, $validator) {
            $enum = $parameters[0] ?? null;

            return (new EnumKey($enum))->passes($attribute, $value);
        });

        Validator::extend('enum_value', function($attribute, $value, $parameters, $validator) {
            $enum = $parameters[0] ?? null;

            $strict = $parameters[1] ?? null;

            if (! $strict) {
                return (new EnumValue($enum))->passes($attribute, $value);
            }

            $strict = !! json_decode(strtolower($strict));

            return (new EnumValue($enum, $strict))->passes($attribute, $value);
        });
    }
119741
public function validate()
    {
        $setToBreak = false;

        foreach ($this->_validations as $v) {
            foreach ($v['fields'] as $field) {
                if (isset($this->_skips[$field])) {
                    if ($this->_skips[$field] === self::SKIP_ALL) {
                        break 2;
                    }

                    if ($this->_skips[$field] === self::SKIP_ONE) {
                        break;
                    }
                }

                [$values, $multiple] = $this->getPart($this->_fields, \explode('.', $field));

                // Don't validate if the field is not required and the value is empty
                if (null !== $values && $this->hasRule('optional', $field)) {
                    //Continue with execution below if statement
                } elseif (
                    $v['rule'] !== 'accepted' &&
                    $v['rule'] !== 'required' && !$this->hasRule('required', $field) &&
                    (null === $values || $values === '' || ($multiple && \count($values) === 0))
                ) {
                    continue;
                }

                // Callback is user-specified or assumed method on class
                $errors = $this->getRules();
                if (isset($errors[$v['rule']])) {
                    $callback = $errors[$v['rule']];
                } else {
                    $callback = [$this, 'validate' . \ucfirst($v['rule'])];
                }

                if (!$multiple) {
                    $values = [$values];
                }

                $result = true;
                foreach ($values as $value) {
                    $result = $result && $callback($field, $value, $v['params'], $this->_fields);
                }

                if (!$result) {
                    $this->error($field, $v['message'], $v['params']);
                    if ($this->stopOnFirstFail) {
                        $setToBreak = true;
                        break;
                    }
                    $this->_skips[$field] = $v['skip'];
                }
            }

            if ($setToBreak) {
                break;
            }
        }

        return \count($this->errors()) === 0;
    }
1116884
public function validate() {        
        if($this instanceof Cache\CacheableValidatableInterface && $this->isValidationCacheEnabled() && $this->lastValidationResult instanceof ValidationResultSet) {
            return $this->lastValidationResult;
        }
        
        $validationResultSet = $this->validateValue($this->getValue());
        
        if($this instanceof Cache\CacheableValidatableInterface && $this->isValidationCacheEnabled()) {
            $this->lastValidationResult = $validationResultSet;
        }
            
        return $validationResultSet;
    }
797382
public function validation()
	{
		if( ! $this->_validation)
		{
			$this->_validation = \Validation::forge(\Str::random('alnum', 32));

			if (isset(static::$_rules) and count(static::$_rules))
			{
				foreach (static::$_rules as $field => $rules)
				{
					$label = (isset(static::$_labels) and array_key_exists($field, static::$_labels)) ? static::$_labels[$field] : $field;
					$this->_validation->add_field($field, $label, $rules);
				}
			}
		}

		return $this->_validation;
	}