Validate if we got a good Customer instance.

@param CustomerInterface $value
974585
protected function validateCustomer(CustomerInterface $value)
    {
        if (empty($value->getFullName()) || empty($value->getEmail())) {
            throw new InvalidArgumentException('Customer name and email address is expected');
        }
    }
1061981
public static function validateType($value)
    {
        if (get_called_class() === $value) {
            return true;
        }
        if (array_key_exists($value, class_implements(get_called_class()))) {
            return true;
        }
        if (array_key_exists($value, class_parents(get_called_class()))) {
            return true;
        }
        throw new InvalidDataTypeException(__CLASS__, new static);
    }
1321219
public static function isValid($value)
    {
        if($value === null){
            return false;
        }

        $reflection = new \ReflectionClass(get_called_class());
        return in_array($value, $reflection->getConstants());
    }
548577
protected function isValid($value)
    {
        if (!is_object($value)) {
            throw new InvalidValidationOptionsException('The value supplied for the UniqueEntityValidator must be an object.', 1358454270);
        }

        $classSchema = $this->reflectionService->getClassSchema(TypeHandling::getTypeForValue($value));
        if ($classSchema === null || $classSchema->getModelType() !== ClassSchema::MODELTYPE_ENTITY) {
            throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must be an entity.', 1358454284);
        }

        if ($this->options['identityProperties'] !== null) {
            $identityProperties = $this->options['identityProperties'];
            foreach ($identityProperties as $propertyName) {
                if ($classSchema->hasProperty($propertyName) === false) {
                    throw new InvalidValidationOptionsException(sprintf('The custom identity property name "%s" supplied for the UniqueEntityValidator does not exists in "%s".', $propertyName, $classSchema->getClassName()), 1358960500);
                }
            }
        } else {
            $identityProperties = array_keys($classSchema->getIdentityProperties());
        }

        if (count($identityProperties) === 0) {
            throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must have at least one identity property.', 1358459831);
        }

        $identifierProperties = $this->reflectionService->getPropertyNamesByAnnotation($classSchema->getClassName(), 'Doctrine\ORM\Mapping\Id');
        if (count($identifierProperties) > 1) {
            throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must only have one identifier property @ORM\Id.', 1358501745);
        }

        $identifierPropertyName = count($identifierProperties) > 0 ? array_shift($identifierProperties) : 'Persistence_Object_Identifier';

        $query = $this->persistenceManager->createQueryForType($classSchema->getClassName());
        $constraints = [$query->logicalNot($query->equals($identifierPropertyName, $this->persistenceManager->getIdentifierByObject($value)))];
        foreach ($identityProperties as  $propertyName) {
            $constraints[] = $query->equals($propertyName, ObjectAccess::getProperty($value, $propertyName));
        }

        if ($query->matching($query->logicalAnd($constraints))->count() > 0) {
            $this->addError('Another entity with the same unique identifiers already exists', 1355785874);
        }
    }
426459
public function isValid($value)
    {
        if (is_null($value)) {
            $result = false;
            $this->error(self::NOT_NULL);
        }
        else
            $result = true;
        return $result;
   }
1280346
public function isValueValid($value) {
		return $value instanceof Type\ProductType || $value instanceof DataType\TextType || $value instanceof DataType\URLType;
	}
593879
public function check($value)
    {
        $this->validateStructure($value);

        if (! $this->refreshFlow) {
            $this->validateTimestamps($value);
        } else {
            $this->validateRefresh($value);
        }
    }
937672
public function isValid($value)
    {
        $acceptedValues = GeneralUtility::trimExplode('|', $this->options['values']);

        if (false === in_array($value, $acceptedValues)) {
            $errorMessage = $this->translateErrorMessage('validator.has_values.not_valid', 'configuration_object', [implode(', ', $acceptedValues)]);
            $this->addError($errorMessage, 1456140151);
        }
    }
1117195
public function isValid($value)
    {
        if (parent::isValid($value)) {
            $this->setValue($value);

            $this->error(self::IN_ARRAY);

            return false;
        }

        return true;
    }
911169
public function isValid($value = null, $context = null)
    {
        if ($value !== null) {
            $this->setCredential($value);
        }

        if (($context !== null) && array_key_exists($this->identity, $context)) {
            $identity = $context[$this->identity];
        } else {
            $identity = $this->identity;
        }
        if (!$this->identity) {
            throw new Exception\RuntimeException('Identity must be set prior to validation');
        }

        if (($context !== null) && array_key_exists($this->credential, $context)) {
            $credential = $context[$this->credential];
        } else {
            $credential = $this->credential;
        }

        if (!$this->service) {
            throw new Exception\RuntimeException('AuthenticationService must be set prior to validation');
        }

        $this->service->setIdentity($identity);
        $this->service->setCredential($credential);

        $result = $this->service->authenticate();

        if ($result->getCode() != Result::SUCCESS) {
            switch ($result->getCode()) {
                case Result::FAILURE_IDENTITY_NOT_FOUND:
                    $this->error(self::IDENTITY_NOT_FOUND);
                    break;
                case Result::FAILURE_CREDENTIAL_INVALID:
                    $this->error(self::CREDENTIAL_INVALID);
                    break;
                case Result::FAILURE_IDENTITY_AMBIGUOUS:
                    $this->error(self::IDENTITY_AMBIGUOUS);
                    break;
                case Result::FAILURE_UNCATEGORIZED:
                    $this->error(self::UNCATEGORIZED);
                    break;
                default:
                    $this->error(self::GENERAL);
            }
            return false;
        }

        return true;
    }
204622
public function isValid($value)
    {
        $this->databaseError = null;

        // Empty connection string is valid (defaults to localhost:defaultPort)
        if (!empty($value) && !preg_match($this->pattern, $value)) {
            $this->error(self::INVALID);

            return false;
        }

        return true;
    }
840064
public function validate($value) {
        if(!filter_var($value, FILTER_VALIDATE_IP, $this->flags)) {
            return new ValidationResult(false, 'Not a valid ip address');
        }        
        return new ValidationResult(true);
    }
920484
public function isValid($value)
    {
        $result = filter_var($value, FILTER_VALIDATE_EMAIL);
        if (!$result) {
            $this->addMessage('email');
        }
        return (boolean) $result;
    }
25031
private function _validateCustomerId($id = null)
    {
        if (empty($id) || trim($id) == "") {
            throw new InvalidArgumentException(
            'expected customer id to be set'
            );
        }
        if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
            throw new InvalidArgumentException(
            $id . ' is an invalid customer id.'
            );
        }

    }
1015620
public function validate($value, Constraint $constraint)
    {
        if($value instanceof SubscriberInterface) {
            if($this->manager->exists($value, $value->getType())) {
                $this->context->buildViolation($constraint->message)
                    ->setParameter('%email%', $value->getEmail())
                    ->addViolation();
            }
        }
    }
1297774
public static function isValid($value)
    {
        if ($value instanceof \DateTime)
            return true;
        try {
            new static($value);
            return !is_null($value);
        } catch (\Exception $e) {
            return false;
        }
    }
588690
public function validate($value)
    {
        $this->pushResult();
        if ($this->acceptsEmptyValues === false || $this->isEmpty($value) === false) {
            $this->isValid($value);
        }
        return $this->popResult();
    }