Check the scheme used in the request URL for validate method
@param \SwaggerValidator\Common\Context $context
@return boolean
432053
protected function checkSchemes(\SwaggerValidator\Common\Context $context)
    {
        if (!isset($this->schemes)) {
            return true;
        }

        foreach ($this->schemes as $oneScheme) {
            if (strtolower($context->getDataValue()) && strtolower($oneScheme)) {
                return true;
            }
        }

        return $context->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_DATAVALUE, 'Scheme requested is not allowed', __METHOD__, __LINE__);
    }
66483
protected function _actionValidate($context)
    {
        $data = $context->data;
        $key = $data->key;
        $value = $data->value;
        $method = 'validate'.ucfirst($key);
        $result = true;
        $result = $this->getValidator()->$method($value);
        $output = $this->getValidator()->getMessage();

        if ($result === false) {
            $context->response->status = AnHttpResponse::PRECONDITION_FAILED;

            if (is_string($output)) {
                $output = array('errorMsg' => $output);
            }

            $context->response->validation = json_encode($output);
        } else {
            $context->response->validation = json_encode($output);
        }
    }
513478
protected function validateInput(array $context, array $requiredFields = [])
    {
        foreach ($requiredFields as $requiredField) {
            if (empty($context[$requiredField])) {
                throw new InvalidArgumentException('Missing required field ' . $requiredField);
            }
        }
        return true;
    }
447486
public function validate(
        string $path,
        $model,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $model) {
            return [];
        }

        $criteria = $this->getCriteria($model);

        $modelClass = get_class($model);

        if (null === $persistedModel = $this->objectManager->getRepository($modelClass)->findOneBy($criteria)) {
            return [];
        }

        $metadata = $this->objectManager->getClassMetadata($modelClass);

        if ($this->isValueSameAsPersistedValue($metadata->getIdentifier(), $model, $persistedModel)) {
            return [];
        }

        $errors = [];

        foreach ($this->uniqueProperties as $uniqueProperty) {
            $errors[] = new Error(
                '' !== $path ? $path.'.'.$uniqueProperty : $uniqueProperty,
                'constraint.unique.notunique',
                ['uniqueProperties' => implode(', ', $this->uniqueProperties)]
            );
        }

        return $errors;
    }
294994
public function validate($context = 'payload')
    {
        $args = func_get_args();
        array_shift($args);

        $this->each(function ($claim) use ($context, $args) {
            call_user_func_array(
                [$claim, 'validate'.Str::ucfirst($context)],
                $args
            );
        });

        return $this;
    }
1181682
public function validateDeliveryDni(ExecutionContextInterface $context)
    {
        $dni = $this->getDeliveryDni();

        if (is_null($dni)) {
            return;
        }

        // check format
        if (0 === preg_match("/\d{1,8}[a-z]/i", $dni)) {
            $context->addViolationAt('dni', 'Invalid DNI number');

            return;
        }

        // check letter
        $number = substr($dni, 0, -1);
        $letter  = strtoupper(substr($dni, -1));
        if ($letter != substr("TRWAGMYFPDXBNJZSQVHLCKE", strtr($number, "XYZ", "012")%23, 1)) {
            $context->addViolationAt('dni', 'Invalid DNI letter');
        }
    }
604662
public function checkLink(ExecutionContextInterface $context)
    {
        $violation = false;
        // check if the name is actually a fake name
        switch ($this->getLinkType()) {
            case self::TYPE_VIEW_REFERENCE:
            $violation = $this->getViewReference() == null;
                break;
            case self::TYPE_ROUTE:
            $violation = $this->getRoute() == null;
                break;
            case self::TYPE_URL:
            $violation = $this->getUrl() == null;
                break;
            case self::TYPE_WIDGET:
            $violation = $this->getAttachedWidget() == null;
                break;
            default:
                break;
        }

        if ($violation) {
            $context->buildViolation('validator.link.error.message.'.$this->getLinkType().'Missing')->addViolation();
        }
    }
403943
public function setContext($context)
    {
        $contexts = array(self::CONTEXT_CREDITCARD, self::CONTEXT_TOKEN);
        if (!in_array($context, $contexts)) {
            throw new RuntimeException(
                sprintf("Invalid validation context '%s'", $context)
            );
        }

        $this->context = $context;
    }
339982
public function hasContext($context)
    {
        if ($this->contextConfiguration && array_key_exists($context, $this->contextConfiguration)) {
            return true;
        }

        return false;
    }
111065
protected function validate()
    {
        if (!CommonUtils::isRegexExpr($this->pattern)) {
            return false;
        }

        return (bool) preg_match(
            $this->pattern,
            $this->getRequestValue()
        );
    }
773893
private function validateCommon( $taxonomy, $contextParameters )
	{
		// if ( ! $this->validateParameters( $taxonomy, $contextParameters ) )
		// {
		// 	return false;
		// }

		if ( ! $this->validateCustomFunction( $taxonomy ) )
		{
			return false;
		}

		if ( ! $this->validateVariableSets( $taxonomy, $contextParameters ) )
		{
			return false;
		}

		if ( ! $this->validateConsistencyAssertions( $taxonomy ) )
		{
			return false;
		}

		// validate default dimensions in instances and accumulate multi-instance-default dimension aspects (really, look in the contexts)

		// check for variable set dependencies across output instances produced

		return true;
	}
1047405
public function evaluate(Context $context)
    {
        /** @var Proposition $operand */
        foreach ($this->getOperands() as $operand) {
            if ($operand->evaluate($context) === true) {
                return true;
            }
        }

        return false;
    }
1052963
protected function validateTooMany(\SwaggerValidator\Common\Context $context)
    {
        $sandBox = $context->getSandBoxKeys();

        foreach ($context->getRequestDataKeys() as $location => $list) {

            if (!array_key_exists($location, $sandBox)) {
                continue;
            }

            if ($location == \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY) {
                $ctx = $context->setLocation($location)->setDataPath($location)->setDataCheck('exist');
                $ctx->loadRequestBody();

                if ($ctx->isDataExists() && !$sandBox[$location]) {
                    $ctx->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_TOOMANY, 'Body is given and not expected', __METHOD__, __LINE__);
                }

                continue;
            }

            foreach ($list as $key) {

                if (in_array($key, $sandBox[$location])) {
                    continue;
                }

                $ctx->setDataPath($key)->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_TOOMANY, $key . ' is given and not expected', __METHOD__, __LINE__);
            }
        }

        $context->setDataPath('CheckTooMany')->logValidate(get_class($this), __METHOD__, __LINE__);
        return true;
    }
474660
public function evaluate( Context $context ) {
		/* @var \Ruler\Variable $left */
		list( $left ) = $this->getOperands();

		$value = $left->prepareValue( $context )->getValue();

		if ( is_null( $value ) ) {
			return true;
		}

		if ( is_string( $value ) ) {
			return trim( $value ) === '';
		}

		if ( $value instanceof \Countable ) {
			return count( $value ) === 0;
		}

		return empty( $value );
	}
272891
private static function check_contexts(context $context, $values) {
        if ($context->contextlevel > CONTEXT_COURSECAT) {
            return self::check_contexts($context->get_parent_context(), $values);
        } else if ($context->contextlevel == CONTEXT_COURSECAT) {
            if (in_array($context->instanceid, $values)) {
                return true;
            } else {
                return self::check_contexts($context->get_parent_context(), $values);
            }
        } else {
            return false;
        }
    }
150746
public function setContext(RequestContext $context)
    {
        foreach ($this->matchers as $matcher) {
            $matcher->setContext($context);
        }

        $this->context = $context;
    }
842796
public function isTargetValid(ExecutionContextInterface $context)
    {
        // Menu is not root and has no url or Article linked
        if ($this->getParent() != $this && !$this->getUrl() && !$this->getArticle()) {
            $context->addViolationAt('url', 'This value should not be blank.');
        }
    }