Determine if the data passes the validation rules.

@return bool
14856
public function passes()
    {
        $this->message = null;
        foreach ($this->rules as $attribute => $rules) {
            foreach ($rules as $rule) {
                if (!$this->validate($attribute, $rule)) {
                    return false;
                }
            }
        }

        return true;
    }
1258487
public function isValid()
    {
        $this->applyFilters();

        $this->validationMessage = null;

        foreach ($this->validators as $validator) {
            if (!$validator->isValid($this->translations)) {
                $this->validationMessage = $validator->getMessage();
                return false;
            }
        }

        return true;
    }
1342823
public function preValidate(): bool
    {
        $this->errors = [];

        if (!\is_array($this->parsedfile)) {
            $this->errors[] = 'Incorrect format parsed file';

            return false;
        }

        $r = $this->readUNHmessageNumber();
        if (!$r && isset($this->errors[0]) && $this->errors[0] == 'Segment "UNH" is ambiguous') {
            $this->errors = [];
            $this->errors[] = 'File has multiple messages';

            return false;
        }

        return true;
    }
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;
    }
494507
public function isValid()
    {
        foreach ($this->objects as $fileInfo) {
            // Before validation callback
            $this->applyCallback('beforeValidation', $fileInfo);

            // Check is uploaded file
            if ($fileInfo->isUploadedFile() === false) {
                $this->errors[] = sprintf(
                    '%s: %s',
                    $fileInfo->getNameWithExtension(),
                    'Is not an uploaded file'
                );
                continue;
            }

            // Apply user validations
            foreach ($this->validations as $validation) {
                try {
                    $validation->validate($fileInfo);
                } catch (\Upload\Exception $e) {
                    $this->errors[] = sprintf(
                        '%s: %s',
                        $fileInfo->getNameWithExtension(),
                        $e->getMessage()
                    );
                }
            }

            // After validation callback
            $this->applyCallback('afterValidation', $fileInfo);
        }

        return empty($this->errors);
    }
517852
public function validateOrFail()
    {
        // Validate data
        $passed = $this->validate();

        // If validation failed,
        // we'll throw an exception
        if (! $passed) {
            throw new ValidationException($this->validator, $this->getErrorCodes());
        }

        return true;
    }
654834
public function validateValidItem()
    {
        if (!$this->value) {
            return;
        }

        // load allowed values in values_list
        // @todo Imants: Actually we don't need to load all values from Model in
        //       array, just to check couple of posted values.
        //       Probably we should do SELECT * FROM t WHERE id IN ($values) or
        //       something like that to limit array size and time spent on
        //       parsing all DB records in Model.
        $this->getValueList();

        $values = explode($this->separator, $this->value);
        foreach ($values as $v) {
            if (!isset($this->value_list[$v])) {
                $this->displayFieldError("Value $v is not one of the offered values");

                return $this->validate();
            }
        }
    }
561681
public function validate(array $data) : bool
    {
        $passed = true;
        $this->invalidFields = [];
        $rules = $this->getRules();
        foreach ($rules as $validation => $fields) {
            foreach ($fields as $key => $value) {
                $field = $this->getFieldInfo($key, $value);
                $validationInstance = $this->getValidation($validation);
                $validationStatus = $validationInstance->run($field, $data);
                $passed = $passed && $validationStatus;
                $this->invalidFields = array_merge_recursive(
                        $this->invalidFields, $validationInstance->getMessages()
                );
            }
        }
        return $passed;
    }
1023524
public function validate() {
        $this->_errors = [];

        // No rules
        if (!$this->validate) {
            return true;
        }

        // Build the validator
        $validator = $this->getValidator();
        $validator->reset();
        $validator->addMessages($this->messages);
        $validator->setData($this->toArray());

        $event = $this->emit('model.preValidate', [$this, $validator]);

        // Exit early if event has returned false
        if ($event->getData() === false) {
            return false;
        }

        $status = $validator->validate();

        $this->_errors = $validator->getErrors();
        $this->_validator = null;

        $this->emit('model.postValidate', [$this, $status]);

        return $status;
    }
1294567
public function isValid()
    {
        $valid = true;
        foreach ($this->_errors as $input => $message) {
            foreach ($message as $item) {
                if (!empty($item)) {
                    $valid = false;
                }
            }
        }

        foreach ($this->_input as $key => $value) {
            \Session::delete('input.'.$key);
        }

        return $valid;
    }
630511
public function passes()
	{
		$this->messages = new MessageBag;

		// We'll spin through each rule, validating the attributes attached to that
		// rule. Any error messages will be added to the containers with each of
		// the other error messages, returning true if we don't have messages.
		foreach ( $this->rules as $attribute => $rules )
			foreach ( $rules as $rule )
			{
				$this->validate( $attribute, $rule );

				if ( $this->shouldStopValidating( $attribute ) )
					break;
			}

		// Here we will spin through all of the "after" hooks on this validator and
		// fire them off. This gives the callbacks a chance to perform all kinds
		// of other validation that needs to get wrapped up in this operation.
		foreach ( $this->after as $after )
			call_user_func( $after );

		return $this->messages->isEmpty();
	}
73044
public static function valid($data)
    {
        $rules = [
            'body' => 'required|min:3',
            'post_id' => 'required|min:1|integer|exists:forum_posts,id',
            'author_id' => 'required|min:1|integer|exists:users,id'
        ];
        $validator = Validator::make($data, $rules);

        if ($validator->passes()) {
            return true;
        }
        return false;
    }
1239984
public function validateReceived()
    {
        $this->debugMessage[] = 'IPN VALIDATION: START';
        if (!$this->ipnPostDataCheck()) {
            $this->debugMessage[] = 'IPN VALIDATION: END';
            return false;
        }

        //'ORDERSTATUS'
        $this->logFunc("IPN", $this->postData, @$this->postData['REFNOEXT']);
        if (!in_array(trim($this->postData['ORDERSTATUS']), $this->successfulStatus)) {
            $this->errorMessage[] = 'INVALID IPN ORDER STATUS: ' . $this->postData['ORDERSTATUS'];
            $this->debugMessage[] = 'IPN VALIDATION: END';
            return false;
        }
        $validationResult = false;
        $calculatedHashString = $this->createHashString($this->flatArray($this->postData, array("HASH")));
        if ($calculatedHashString == $this->postData['HASH']) {
            $validationResult = true;
        }
        if ($validationResult) {
            $this->debugMessage[] = 'IPN VALIDATION: ' . 'SUCCESSFUL';
            $this->debugMessage[] = 'IPN CALCULATED HASH: ' . $calculatedHashString;
            $this->debugMessage[] = 'IPN HASH: ' . $this->postData['HASH'];
            $this->debugMessage[] = 'IPN VALIDATION: END';
            return true;
        } elseif (!$validationResult) {
            $this->errorMessage[] = 'IPN VALIDATION: ' . 'FAILED';
            $this->errorMessage[] = 'IPN CALCULATED HASH: ' . $calculatedHashString;
            $this->errorMessage[] = 'IPN RECEIVED HASH: ' . $this->postData['HASH'];
            $this->debugMessage[] = 'IPN VALIDATION: END';
            return false;
        }
        return false;
    }
982319
public function validate()
    {
        if (is_numeric($this->categoryId) && $this->categoryId >= 1
                && is_numeric($this->forumId) && $this->forumId >= 1
                && is_numeric($this->threadId) && $this->threadId >= 1
                && !empty($this->threadSlug)) {
            return true;
        }
        return false;
    }
482650
public function isValid() {
		
		$params = $this -> getParameters();
		$file 	= $this -> getFile();
		$info 	= (object) pathinfo($file['name']);
		$params = array_map(function($value) {

			if(false === is_string($value)) {
				return trigger_error(sprintf('Extension passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
			}

			return ltrim(strtolower($value), '.');
		}, $params);

		if(true === isset($info -> extension) && false === in_array($info -> extension, $params)) {
			return true;
		}

		return false;
	}
1031543
public function rules() {
		$args = array();

		foreach ( $this->rules as $arg => $validation ) {
			if ( ! $validation || ! is_string( $validation ) ) {
				continue;
			}

			$args[ $arg ] = $this->parse_validation( $validation );
		}

		return $args;
	}
1009918
public function hasData ()
	{
		if (!isset ($this->data))
		{
			if (!isset ($this->error))
				$this->setError ('No input data set');

			return false;
		}
		else {
			return true;
		}
	}