public function pass($value, array $allValues = [], bool $haltFieldValidationOnFailure = false) : bool
    {
        $this->errorSlugsAndPlaceholders = [];
        $passes = true;

        foreach ($this->rules as $rule) {
            // Non-required fields do not need to evaluate all rules when empty
            if (!$this->isRequired) {
                if (
                    $value === null ||
                    (is_string($value) && $value === '') ||
                    ((is_array($value) || $value instanceof Countable) && count($value) === 0)
                ) {
                    continue;
                }
            }

            $thisRulePasses = $rule->passes($value, $allValues);

            if (!$thisRulePasses) {
                $this->addError($rule);
            }

            if ($haltFieldValidationOnFailure) {
                if (!$thisRulePasses) {
                    return false;
                }
            } else {
                $passes = $thisRulePasses && $passes;
            }
        }

        return $passes;
    }
public function pass($value, array $allValues = [], bool $haltFieldValidationOnFailure = false) : bool
    {
        $this->errorSlugsAndPlaceholders = [];
        $passes = true;

        foreach ($this->rules as $rule) {
            // Non-required fields do not need to evaluate all rules when empty
            if (!$this->isRequired) {
                if (
                    $value === null ||
                    (is_string($value) && $value === '') ||
                    ((is_array($value) || $value instanceof Countable) && count($value) === 0)
                ) {
                    continue;
                }
            }

            $thisRulePasses = $rule->passes($value, $allValues);

            if (!$thisRulePasses) {
                $this->addError($rule);
            }

            if ($haltFieldValidationOnFailure) {
                if (!$thisRulePasses) {
                    return false;
                }
            } else {
                $passes = $thisRulePasses && $passes;
            }
        }

        return $passes;
    }
public function pass ( $ value , array $ allValues = [ ] , bool $ haltFieldValidationOnFailure = false ) : bool { $ this -> errorSlugsAndPlaceholders = [ ] ; $ passes = true ; foreach ( $ this -> rules as $ rule ) { // Non-required fields do not need to evaluate all rules when empty if ( ! $ this -> isRequired ) { if ( $ value === null || ( is_string ( $ value ) && $ value === '' ) || ( ( is_array ( $ value ) || $ value instanceof Countable ) && count ( $ value ) === 0 ) ) { continue ; } } $ thisRulePasses = $ rule -> passes ( $ value , $ allValues ) ; if ( ! $ thisRulePasses ) { $ this -> addError ( $ rule ) ; } if ( $ haltFieldValidationOnFailure ) { if ( ! $ thisRulePasses ) { return false ; } } else { $ passes = $ thisRulePasses && $ passes ; } } return $ passes ; }
Gets whether or not all the rules pass

@param mixed $value The value to validate
@param array $allValues The list of all values
@param bool $haltFieldValidationOnFailure True if we want to not check any other rules for a field
once one fails, otherwise false
@return bool True if all the rules pass, otherwise false
Gets whether or not all the rules pass