Check if there is any undefined wildcard

@param string $input
@param string $errorClass the class where the wildcard should be defined (if validation doesn't pass)

@return boolean
@throws Exception
188522
public function validateWildCards($input, $errorClass = '')
    {
        preg_match_all('@\{.*?\}}@',  $input, $matches);
        $notDefined = [];

        if($matches) {
            foreach ($matches as $match) {
                foreach ($match as $wildcard) {
                    if (!array_key_exists($wildcard, $this->getWildcards())) {
                        $notDefined[] = $wildcard;
                    }
                }
            }
        }

        if($notDefined) {
            throw new \Exception('Not defined wildcards "'.implode($notDefined, ', ').'". '.($errorClass ? 'Please declare them on "metaData" method of "'.$errorClass.'".' : ''));
        }

        return true;
    }
1141391
public function validate(array $input, array $ruleset)
    {
        $this->errors = array();

        foreach ($ruleset as $field => $rules) {
            #if(!array_key_exists($field, $input))
            #{
            #   continue;
            #}

            $rules = explode('|', $rules);

            if (in_array('required', $rules) || (isset($input[$field]) && trim($input[$field]) != '')) {
                foreach ($rules as $rule) {
                    $method = null;
                    $param = null;

                    if (strstr($rule, ',') !== false) {
                        // has params

                        $rule = explode(',', $rule);
                        $method = 'validate_'.$rule[0];
                        $param = $rule[1];
                        $rule = $rule[0];
                    } else {
                        $method = 'validate_'.$rule;
                    }

                    if (is_callable(array($this, $method))) {

                        $result = $this->$method($field, $input, $param);

                        if (is_array($result)) {
                            // Validation Failed

                            $this->errors[] = $result;
                        }
                    } elseif (isset($this->validation_methods[$rule])) {
                        if (isset($input[$field])) {
                            $result = call_user_func($this->validation_methods[$rule], $field, $input, $param);


                            if (!$result) {
                                // Validation Failed

                                $this->errors[] = array(
                                    'field' => $field,
                                    'value' => $input[$field],
                                    'rule' => $method,
                                    'param' => $param,
                                );
                            }
                        }
                    } else {
                        throw new Exception("Validator method '$method' does not exist.");
                    }
                }
            }
        }

        $this->compileMessage();

        return $this;
    }
601525
protected function validate(string $input): bool
    {
        return preg_match($this->realNumber ? self::REAL_NUMBER_REGEXP : self::INTEGER_REGEXP, $input) === 1;
    }
684456
public function check($input)
    {
        if ($this->lazy) {
            $this->lazy = false;
            $this->parseDefinition();
        }
        $this->lastValue = $input;
        if (strlen($input) === 0 && $this->skipEmpty) {
            return true;
        }
        $constraint = $this->constraint;
        return $constraint($input, $this, $this->attrib, $this->dataFilter);
    }
1170393
public String getErrorAndRequiredClass(UIInput input, String clientId) {
		String styleClass = "";
		if (BsfUtils.isLegacyFeedbackClassesEnabled()) {
			styleClass = FacesMessages.getErrorSeverityClass(clientId);
		}
		if (input.isRequired()) {
			styleClass += " bf-required";
		} else {
			Annotation[] readAnnotations = ELTools.readAnnotations(input);
			if (null != readAnnotations && readAnnotations.length > 0) {
				for (Annotation a : readAnnotations) {
					if ((a.annotationType().getName().endsWith("NotNull"))
							|| (a.annotationType().getName().endsWith("NotEmpty"))
							|| (a.annotationType().getName().endsWith("NotBlank"))) {
						styleClass += " bf-required";
						break;
					}
				}
			}
		}
		return styleClass;
	}
299538
public function match($input)
    {
       
        $noMatch = true;
        foreach ($this->matchers as $matcher) {
            if ($matcher->noMatch()) {
                continue;
            }
            if ($matcher->match($input)) {
                $noMatch = false;
            }
            if ($matcher->matchFound()) {
                $this->matched[] = $matcher->matched;
                $this->resetMatchers();
                break;
            }
        }
        if ($noMatch) {
            return false;
        }
        return true;
    }
452664
@Override
    public boolean isValid(Object input) {
        int value;
        try {
            value = Integer.parseInt(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minAllowedValue != null && value < minAllowedValue)
            return false;
        if (maxAllowedValue != null && value > maxAllowedValue)
            return false;
        return true;
    }
849755
public void setErrorClass(byte errorClass) throws IllegalArgumentException {
		if (errorClass < 0 || errorClass > 99) {
			throw new IllegalArgumentException(
					errorClass
							+ "Only error classes between 0 and 99 are valid. Current class: "
							+ errorClass);
		}
		this.errorClass = errorClass;
	}
109324
public function validate($input): bool
    {
        // for array
        if (\is_array($input)) {
            return \in_array($this->containsValue, $input, false);
        }
        // for string
        if (\is_string($input)) {
            return false !== mb_stripos($input, $this->containsValue, 0, mb_detect_encoding($input));
        }
        // can't compare
        return false;
    }
1056164
public function validate($input, $country)
    {
        $country = trim(strtolower($country));

        if (!$this->supportsCountry($country)) {
            throw new Exception('Unsupported country: ' . $country);
        }

        if (!$input) {
            return true;
        }

        /** @var \Rickard2\Luhnar\Validator\Validator $validator */
        $validator = new $this->countryClassMap[$country];

        return $validator->validate($input);
    }
993604
static function wildcardToRegexp( $wildcard, $separatorCharacter = false )
    {
        if ( !$separatorCharacter )
            $separatorCharacter = '#';
        $wildcardArray = preg_split( "#[*]#", $wildcard, -1, PREG_SPLIT_DELIM_CAPTURE );
        $wildcardList = array();
        $i = 0;
        foreach ( $wildcardArray as $wildcardElement )
        {
            if ( ( $i % 2 ) == 1 )
                $wildcardList[] = '(.+)';
            else
                $wildcardList[] = preg_quote( $wildcardElement, $separatorCharacter );
            ++$i;
        }
        $wildcardString = implode( '', $wildcardList );
        return $wildcardString;
    }
1147465
function(input) {
		var needstesting = !this._matches.length;
		if (needstesting || this._matches.every(function(match) {
			return match.$instanceid !== input.$instanceid;
		})) {
			return this._maybeinput(input);
		}
		return false;
	}
600538
public function validate($input): bool
    {
        if (\is_array($this->haystack)) {
            return \in_array($input, $this->haystack, false);
        }

        if (!\is_string($this->haystack)) {
            return false;
        }

        if (empty($input)) {
            return false;
        }

        $enc = mb_detect_encoding($input);

        return mb_stripos($this->haystack, $input, 0, $enc) !== false;
    }
76702
function wildCardMatch(text, pattern){
	var cards = pattern.split("*");
	if (!pattern.startsWith("*") && !text.startsWith(cards[0])) { //$NON-NLS-1$
		return false;
	}
	if (!pattern.endsWith("*") && !text.endsWith(cards[cards.length - 1])) { //$NON-NLS-1$
		return false;
	}
	return !cards.some(function(card){
		var idx = text.indexOf(card);
		if (idx === -1){
			return true;
		}
		text = text.substring(idx + card.length);
	});
}
267617
public function validateReflectionClassForAccessorProtected(\ReflectionClass $reflectionClass)
    {
        if (empty($methods = $reflectionClass->getMethods(\ReflectionMethod::IS_PROTECTED))) {
            return new CoverFishMessageError(
                CoverFishMessageError::PHPUNIT_REFLECTION_NO_PROTECTED_METHODS_FOUND, null
            );
        }

        return true;
    }
411854
static private function checkRangeDomain($res, string $class): bool {
        if ($class == '') {
            return true;
        }

        if (is_a($res, 'EasyRdf\Literal')) {
            //TODO check xsd types against literal values
            return true;
        } else {
            $classes = array();
            foreach ($res->allResources(self::RDFS_TYPE) as $i) {
                $i         = $i->getUri();
                $classes[] = $i;
                if (isset(self::$classes[$i])) {
                    $classes = array_merge($classes, self::$classes[$i]);
                }
            }
            return in_array($class, $classes);
        }
    }
984899
public function check(array $input)
    {
        $missing = [];
        $invalid = [];

        $check = function ($constraint, $key, $value, $input) use (
            &$missing,
            &$invalid
        ) {
            if ($constraint instanceof AbstractConstraint) {
                if (!$constraint->check($value, $input)) {
                    $invalid[$key][] = $constraint;
                }
            } elseif ($constraint instanceof CheckableInterface) {
                $result = $constraint->check($value);

                $missing = Std::concat(
                    $missing,
                    array_map(
                        function ($subKey) use ($key) {
                            return vsprintf('%s.%s', [$key, $subKey]);
                        },
                        $result->getMissing()
                    )
                );

                foreach ($result->getFailed() as $failedField => $constraints) {
                    $fullPath = vsprintf('%s.%s', [$key, $failedField]);

                    if (array_key_exists($fullPath, $invalid)) {
                        $invalid[$fullPath] = array_merge(
                            $invalid[$fullPath],
                            $constraints
                        );
                    } else {
                        $invalid[$fullPath] = $constraints;
                    }
                }
            } else {
                throw new CoreException(
                    vsprintf(
                        'Unexpected constraint type: %s.',
                        [
                            TypeHound::fetch($constraint),
                        ]
                    )
                );
            }
        };

        $inputMap = ArrayMap::of($input);

        $this->annotations->each(
            function ($value, $key) use (
                $check,
                $input,
                $inputMap,
                &$missing
            ) {
                // If a field is required but not present, we should report it.
                if (Maybe::fromMaybe(
                        false,
                        $value->lookup(static::ANNOTATION_REQUIRED)
                    )
                    && $inputMap->member($key) === false
                ) {
                    $missing[] = $key;

                    // There's no point on checking constraints on the field
                    // since it is missing.
                    return;
                } elseif ($inputMap->member($key) === false) {
                    // There's no point on checking constraints on the field
                    // since it is missing.
                    return;
                }

                $fieldValue = Maybe::fromJust($inputMap->lookup($key));

                $this
                    ->getInternalFieldConstraints($key)
                    ->each(
                        function ($constraint) use (
                            $check,
                            $key,
                            $fieldValue,
                            $input
                        ) {
                            $check($constraint, $key, $fieldValue, $input);
                        }
                    );
            }
        );

        if (count($missing) === 0 && count($invalid) === 0) {
            return new SpecResult($missing, $invalid, SpecResult::STATUS_PASS);
        }

        return new SpecResult($missing, $invalid, SpecResult::STATUS_FAIL);
    }