Creates a new `ValidationClause` to specify conditions for future
validations checked against the given property.

@param string $targetProperty Property to validate

@return ValidationClause
435537
public function when($targetProperty)
    {
        $this->property = $targetProperty;
        $this->clause = new ValidationClause($this->parent, $this, true);
        return $this->clause;
    }
684089
protected function validatePropertyStructure($property)
    {
        return is_object($property) && isset($property->profile) && isset($property->name) && isset($property->values);
    }
1106403
public function validatePropertyAnnotation($annotation)
    {
        if (!in_array($annotation, $this->propertyAnnotations)) {
            throw $this->getException(
                'The property annotation isn\'t valid ("%s" given, expecting one of following: %s)',
                [$annotation, implode(', ', $this->propertyAnnotations)]
            );
        }

        return $annotation;
    }
1127798
public function matchRules(string $targetType, $targetValue): array
    {
        $query = $this->getRuleSelectQuery();
        $query
            ->innerJoin(
                'r',
                'ngbm_rule_target',
                'rt',
                $query->expr()->eq('r.id', 'rt.rule_id')
            )
            ->where(
                $query->expr()->eq('rd.enabled', ':enabled'),
                $query->expr()->eq('rt.type', ':target_type')
            )
            ->setParameter('target_type', $targetType, Type::STRING)
            ->setParameter('enabled', true, Type::BOOLEAN)
            ->addOrderBy('rd.priority', 'DESC');

        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'r.status');
        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'rt.status');

        if (!isset($this->targetHandlers[$targetType])) {
            throw TargetHandlerException::noTargetHandler('Doctrine', $targetType);
        }

        $this->targetHandlers[$targetType]->handleQuery($query, $targetValue);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
528525
public function visitPropertiesConstraint(ObjectValue\PropertiesConstraint $constraint)
    {
        $value = $this->currentValue();
        if (!$value instanceof Value\ObjectValue) {
            return $this->createResult();
        }

        $result = $this->createResult();
        $matchedProperties = array();

        // properties
        foreach ($constraint->schemas() as $property => $schema) {
            if ($value->has($property)) {
                $matchedProperties[$property] = true;
                $result = $result->merge(
                    $this->validateObjectProperty($property, $schema)
                );
            } elseif (null !== $schema->defaultValue()) {
                $result = $result->merge(
                    $this->createResult(
                        array(),
                        array($this->createDefaultValueMatch($schema, $property))
                    )
                );
            }
        }

        // pattern properties
        foreach ($constraint->patternSchemas() as $pattern => $schema) {
            $pattern = $this->wrapPattern($pattern);

            foreach ($value->keys() as $property) {
                if (preg_match($pattern, $property)) {
                    $matchedProperties[$property] = true;
                    $result = $result->merge(
                        $this->validateObjectProperty($property, $schema)
                    );
                }
            }
        }

        // additional properties
        foreach ($value->keys() as $property) {
            if (!array_key_exists($property, $matchedProperties)) {
                $result = $result->merge(
                    $this->validateObjectProperty(
                        $property,
                        $constraint->additionalSchema()
                    )
                );
            }
        }

        return $result;
    }
846460
protected Set<ConstraintViolation<T>> doValidate(final T object, final String property) {
		if (property == null) {
			final Set<ConstraintViolation<T>> ret = Sets.newHashSet();
			PropertyDescriptor[] propertyDescriptors;
			try {
				propertyDescriptors = Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors();
			}
			catch (IntrospectionException e) {
				throw new IllegalStateException("Could not retrieve property information");
			}
			for (final PropertyDescriptor prop : propertyDescriptors) {
				String propertyName = prop.getName();
				if (formModel.hasValueModel(propertyName) && !ignoredProperties.contains(propertyName)) {
					final Set<ConstraintViolation<T>> result = validator.validateValue(beanClass, propertyName, formModel
							.getValueModel(propertyName).getValue()); //validator.validateProperty(object, propertyName);
					if (result != null) {
						ret.addAll(result);
					}
				}
			}
			return ret;
		}
		else if (!ignoredProperties.contains(property) && formModel.hasValueModel(property)) {
			return validator.validateValue(beanClass, property, formModel
							.getValueModel(property).getValue());
		}
		else {
			return null;
		}
	}
762075
static void validate( Map<String,String> targetProperties ) throws TargetException {

		checkProperty( API_URL, targetProperties );
		checkProperty( IMAGE_NAME, targetProperties );
		checkProperty( TENANT_NAME, targetProperties );
		checkProperty( FLAVOR_NAME, targetProperties );
		checkProperty( SECURITY_GROUP, targetProperties );
		checkProperty( KEY_PAIR, targetProperties );
		checkProperty( USER, targetProperties );
		checkProperty( PASSWORD, targetProperties );
	}
1033249
public function validateProperties(array $properties)
    {
        $definedProperties = $this->defineProperties() ?: [];

        /*
         * Determine and implement default values
         */
        $defaultProperties = [];

        foreach ($definedProperties as $name => $information) {
            if (array_key_exists('default', $information)) {
                $defaultProperties[$name] = $information['default'];
            }
        }

        $properties = array_merge($defaultProperties, $properties);

        return $properties;
    }
715396
public function compile($definition)
    {
        $validator = $this->createValidator($definition);
        $validator->validate($definition);

        $options = $definition->export();
        $expression = $options['expression'];
        unset($options['expression']);

        return new ExpressionPropertyValidator($expression, $options);
    }
830332
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
    {
        if ($targetEntity->getReflectionClass()->implementsInterface(SoftDeleteAwareInterface::class)) {
            return sprintf('%s.is_deleted = %s', $targetTableAlias, $this->getParameter('isDeleted'));
        }

        return '';
    }
1139897
public function WhenClause()
    {
        $this->match(Lexer::T_WHEN);
        $conditionalExpression = $this->ConditionalExpression();
        $this->match(Lexer::T_THEN);

        return new AST\WhenClause($conditionalExpression, $this->ScalarExpression());
    }
163252
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
    {
        $class = $targetEntity->getName();

        if (\count($this->enabled) && !(\array_key_exists($class, $this->enabled) && true === $this->enabled[$class])) {
            return '';
        }

        if (\array_key_exists($class, $this->disabled) && true === $this->disabled[$class]) {
            return '';
        }

        if (\array_key_exists($targetEntity->rootEntityName, $this->disabled) && true === $this->disabled[$targetEntity->rootEntityName]) {
            return '';
        }

        $em = $this->getEntityManager();

        $config = $this->getListener()->getConfiguration($em, $targetEntity->name);

        if (!isset($config['softDeleteable']) || !$config['softDeleteable']) {
            return '';
        }

        /** @var \Doctrine\DBAL\Connection $conn */
        $conn = $em->getConnection();

        $platform = $conn->getDatabasePlatform();

        $quoteStrategy = $em->getConfiguration()->getQuoteStrategy();

        $column = $quoteStrategy->getColumnName($config['fieldName'], $targetEntity, $platform);

        $addCondSql = $platform->getIsNotNullExpression($targetTableAlias . '.' . $column);

        if (!empty($config['timeAware'])) {
            $now = $conn->quote(date('Y-m-d H:i:s')); // should use UTC in database and PHP
            $addCondSql = "({$addCondSql} OR {$targetTableAlias}.{$column} > {$now})";
        }

        return $addCondSql;
    }
1011805
protected function validateValue($property, $value)
    {
        $this->isPropertyValid($property);

        $regEx = '/^' . self::CONFIRMATION_PROPERTIES[$property] . '$/';

        if (preg_match($regEx, $value) != 1) {
            throw new InvalidArgumentException("The value " . $value . " for the property " . $property . ", is invalid");
        }

        return $value;
    }
455275
public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (sizeof($validatorParams) < 1) {
            throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
        }

        $otherField = $validatorParams[0];
        if (trim($otherField, "'\"") == $otherField) {
            $otherFieldValue = $targetObject->__getSerialisablePropertyValue($otherField);
            return $value == $otherFieldValue;
        } else {
            return $value == $validatorParams[0];
        }

    }
817290
public function validate(array $data, $validateProperties = true)
    {
        $groupsImporter = $this->getImporterByName('groups');
        $rolesImporter  = $this->getImporterByName('roles');
        $toolsImporter  = $this->getImporterByName('tools');
        $importer       = $this->getImporterByName('workspace_properties');
        $usersImporter  = $this->getImporterByName('user');

        //properties
        if ($validateProperties) {
            if (isset($data['properties'])) {
                $properties['properties'] = $data['properties'];
                $importer->validate($properties);
            }
        }

        if (isset($data['roles'])) {
            $roles['roles'] = $data['roles'];
            $rolesImporter->validate($roles);
        }

        if (isset ($data['tools'])) {
            $tools['tools'] = $data['tools'];
            $toolsImporter->validate($tools);
        }

    }
1146590
public function validate($propertyValue, Constraint $constraint)
    {
        // Implement your validation logic.
        // Return early if the value is valid
        // For example:
        if ($propertyValue === 'isValid') {
            return;
        }

        // Finally, if not valid, add the violation
        $this->context->buildViolation($constraint->message)
                      ->setParameter('{{ string }}', $propertyValue)
                      ->addViolation();
    }
986151
public function validate()
    {
        $report = common_report_Report::createInfo();

        foreach ($this->formProperties as $property) {

            try {
                $value = $property['formValue'];

                if (isset($property['validators'])) {
                    foreach ($property['validators'] as $validatorName) {
                        $validatorClass = 'tao_helpers_form_validators_' . $validatorName;
                        if (!class_exists($validatorClass)) {
                            throw new common_Exception('Validator is not correctly set (unknown)');
                        }
                        /** @var ValidatorInterface $validator */
                        $validator = new $validatorClass();
                        if (!$validator->evaluate($value)) {
                            throw new common_exception_ValidationFailed(
                                $property['uri'], $validator->getMessage()
                            );
                        }
                    }
                }

                if (isset($property['range'])) {
                    if (!isset($this->ranges[$property['range']])) {
                        throw new common_Exception($property['label'] . ' : Range is unknown');
                    }
                    $rangeValidated = false;
                    foreach ($this->ranges[$property['range']] as $rangeData) {

                        if (is_array($value)) {
                            foreach ($value as $k => $v) {
                                if ($rangeData['uri'] == $v) {
                                    unset($value[$k]);
                                }
                            }
                            if (empty($value)) {
                                $rangeValidated = true;
                                break;
                            }
                        } else {
                            if ($rangeData['uri'] == $value) {
                                $rangeValidated = true;
                                break;
                            }
                        }

                    }
                    if (!$rangeValidated) {
                        throw new common_exception_ValidationFailed(
                            $property['uri'], 'Range "' . $value . '" for field "' . $property['label'] . '" is not recognized.'
                        );
                    }

                }
            } catch (common_exception_ValidationFailed $e) {
                $subReport = common_report_Report::createFailure($e->getMessage());
                $subReport->setData($property['uri']);
                $report->add($subReport);
            }
        }

        return $report;
    }