Validates the group and throws a number of
Exceptions if validation fails.


@return bool
@throws \Cartalyst\Sentry\Groups\NameRequiredException
@throws \Cartalyst\Sentry\Groups\GroupExistsException
3056
public function validate()
	{
		// Check if name field was passed
		$name = $this->name;

		if ( empty($name) )
		{
			throw new NameRequiredException("A name is required for a group, none given.");
		}

		// Check if group already exists
		$persistedGroup = $this->unique_key_exists($name, 'name');

		if (! $persistedGroup)
		{
			throw new GroupExistsException("A group already exists with name [$name], names must be unique for groups.");
		}

		return true;
	}
1098226
public function isValid()
    {
        $valid = $this->prefix != '';
        $valid = $valid && $this->startMultiLine != '';
        $valid = $valid && $this->endMultiLine != '';
        $valid = $valid && $this->simpleDirective != '';

        return $valid;
    }
269626
public function isValid()
    {
        $valid = true;
        $this->validate();
        foreach ($this->getIterator() as $element) {
            if ($element instanceof ValidationAwareInterface) {
                $valid = $element->isValid()
                    ? $valid
                    : false;
            }
        }
        return $valid;
    }
136697
public function is_valid() {
        $ret = false ;

        if (parent::is_valid() === true) {
            if (is_null($this->id) === false && is_null($this->logicalConnectorWithNext) === false &&
                is_null($this->negation) === false && is_null($this->groupedWith) === false
            ) {
                $ret = true;
            }
        }

        return $ret;
    }
1084607
public function isValid()
    {
        $value = $this->field->getValue();

        if (is_array($value) || is_object($value)) {
            throw new \Exception("This validator only works on scalar types!");
        }

        // required but not given
        if ($this->required && $value == null) {
            return false;
        } // if the field is not required and the value is empty, then it's also valid
        elseif (!$this->required && $value == "") {
            return true;
        }

        $len = strlen($value);

        // shorter then min length
        if ($len < $this->getMinLength()) {
            return false;
        }

        // bigger then the given length
        if ($this->getMaxLength() > 0 && $len > $this->getMaxLength()) {
            return false;
        }

        return true;
    }
725555
public function valid()
    {
        if (!self::$session) {
            Exception::i()->setMessage(self::ERROR_NOT_STARTED)->trigger();
        }

        return isset($_SESSION[$this->key()]);
    }
667785
public function validate()
    {
        $steps = [
            'PrivateKey',
            'IdpMetadata',
            'SpMetadata'
        ];

        foreach ($steps as $step) {
            $method = 'validate' . $step;
            if (!$this->$method()) {
                return false;
            }
        }

        return true;
    }
1259244
public function validate()
	{
		$errors = array();
		foreach ($this->config->getAllTypeMaps() as $typeMap) {
			try {
				$typeMap->validate();
			} catch (\Exception $e) {
				$errors[] = $e->getMessage();
			}
		}

		if (!empty($errors)) {
			throw new ValidationException(implode("\n\n", $errors));
		}
	}
49356
protected function validateEditCategoryGroup()
    {
        $this->setSubmitted('category_group');
        $this->setSubmitted('update', $this->data_category_group);

        $this->validateComponent('category_group');

        return !$this->hasErrors(false);
    }
704540
protected function validateData(EntityGroup $group, $groupname)
    {
        $errors = array();
        
        // Groupname
        if ($this->groupManager->hasGroupForName($groupname) && $this->groupManager->getGroupForName($groupname)->getUuid() != $group->getUuid()) {
            $errors[] = new Error(Error::GENERAL_ERROR, $this->translate('The groupname is already in use.', '\\Zepi\\Web\\AccessControl'));
        }
        
        if (count($errors) > 0) {
            return $errors;
        }
        
        return true;
    }
192612
protected function validate()
    {
        $this->data = $this->module->getInfo($this->module_id);

        if (empty($this->data)) {
            $this->error = $this->translation->text('Failed to read module @id', array('@id' => $this->module_id));
            return false;
        }

        try {
            $this->module_model->checkCore($this->data);
            $this->module_model->checkPhpVersion($this->data);
            return true;
        } catch (Exception $ex) {
            $this->error = $ex->getMessage();
            return false;
        }
    }
275484
public function validate() {

		// check whether a CSRF token was tainted
		
		if($this->enableCsrfToken && !$this->checkCsrfToken()) {

			throw new HtmlFormException('CSRF token mismatch.', HtmlFormException::CSRF_TOKEN_MISMATCH);

		}

		$this->formErrors = [];

		foreach($this->elements as $name => $e) {
			
			if(is_array($e)) {
				foreach($e as $ndx => $elem) {
				    if(!$elem->isValid()) {
                        if (!isset($this->formErrors[$name])) {
                            $this->formErrors[$name] = [];
                        }
                        $this->formErrors[$name][$ndx] = new FormError($elem->getValidationErrorMessage());
                    }
				}
			}

			else if(!$e->isValid()) {
				$this->formErrors[$name] = new FormError($e->getValidationErrorMessage());
			}
		}

		return $this;

	}
161023
protected function HasValidShippingGroup()
    {
        $bHasValidShippingGroup = false;
        $oShipping = $this->GetActiveShippingGroup();
        if (!is_null($oShipping) && $oShipping->IsAvailable()) {
            $bHasValidShippingGroup = true;
        }

        return $bHasValidShippingGroup;
    }
1318585
public function isValid()
    {
        $data = $this->toArray();

        $missing = array_diff(self::$REQUIRED_FIELDS, array_keys($data));

        if ($missing) {
            throw new \InvalidArgumentException('Config is missing the following keys: ' . implode(', ', $missing));
        }

        return true;
    }
71565
public function validate()
    {
        // we don't validate for empty upload fields yet
        if (empty($this->tmpFile['name'])) {
            return true;
        }

        // Check file upload
        if (!$this->isValidUpload()) {
            $this->errors[] = _t('SilverStripe\\Assets\\File.NOVALIDUPLOAD', 'File is not a valid upload');
            return false;
        }

        // Check file isn't empty
        if ($this->isFileEmpty()) {
            $this->errors[] = _t('SilverStripe\\Assets\\File.NOFILESIZE', 'Filesize is zero bytes.');
            return false;
        }

        // filesize validation
        if (!$this->isValidSize()) {
            $arg = File::format_size($this->getAllowedMaxFileSize($this->getFileExtension()));
            $this->errors[] = _t(
                'SilverStripe\\Assets\\File.TOOLARGE',
                'Filesize is too large, maximum {size} allowed',
                'Argument 1: Filesize (e.g. 1MB)',
                array('size' => $arg)
            );
            return false;
        }

        // extension validation
        if (!$this->isValidExtension()) {
            $this->errors[] = _t(
                'SilverStripe\\Assets\\File.INVALIDEXTENSION_SHORT_EXT',
                'Extension \'{extension}\' is not allowed',
                [ 'extension' => $this->getFileExtension() ]
            );
            return false;
        }

        return true;
    }
1065703
protected function verifyGroupRequirements()
    {
        if (isset($this->requiredFieldsGroups)) {
            $fields = $this->requiredFieldsGroups->getArrayCopy();

            $emptyFlag = false;
            $groupsFormatted = [];

            foreach ($fields as $group => $groupFields) {
                $groupsFormatted[] = sprintf(
                    '%s (%s)',
                    ucfirst($group),
                    implode(', ', $groupFields)
                );

                foreach ($groupFields as $field) {
                    if (!empty($this->$field)) {
                        $emptyFlag = true;
                    }
                }
            }

            if (!$emptyFlag) {
                throw new \Genesis\Exceptions\ErrorParameter(
                    sprintf(
                        'One of the following group/s of field/s must be filled in: %s%s',
                        PHP_EOL,
                        implode(
                            PHP_EOL,
                            $groupsFormatted
                        )
                    ),
                    true
                );
            }
        }
    }
1247297
protected function validateRequiredAttributes()
    {
        if (!empty($this->requiredAttributes)) {
            $attributes = $this->fetchAttributes();
            foreach ($this->requiredAttributes as $openIdAttributeName) {
                if (!isset($attributes[$openIdAttributeName])) {
                    return false;
                }
            }
        }

        return true;
    }