Checks if the given value is valid according to the validators of the conjunction.
Every validator has to be valid, to make the whole conjunction valid.

@param mixed $value The value that should be validated
@return ErrorResult
@api
342784
public function validate($value)
    {
        $validators = $this->getValidators();
        if ($validators->count() > 0) {
            $result = null;
            foreach ($validators as $validator) {
                if ($result === null) {
                    $result = $validator->validate($value);
                } else {
                    $result->merge($validator->validate($value));
                }
            }
        } else {
            $result = new ErrorResult();
        }

        return $result;
    }
722
public function validate($value)
    {
        $result = false;

        if (is_string($value) && strlen($value))
        {
            if ($value[0] == '/' || $value[0] == '\\'
                || (strlen($value) > 3 && ctype_alpha($value[0])
                    && $value[1] == ':'
                    && ($value[2] == '\\' || $value[2] == '/')
                )
                || null !== parse_url($value, PHP_URL_SCHEME)
            ) {
                $result = true;
            }
        }

        return $result;
    }
26487
public function isValid($value)
    {
        $messages = [];
        $valid = true;
        foreach ($this->_validators as $validator) {
            if (!$validator->validates($value)) {
                $valid = false;
                $messages[] = $validator->getMessage();
            }
        }
        $this->_messages = $messages;
        return $valid;
    }
582838
protected function validate($value)
    {
        $parsedValue = $this->parsevalue($value);
        if ($parsedValue === false) {
            $this->messenger->add(new StringType('Value cannot be mapped'));
        }

        $ret = $this->rValidate($parsedValue, $this->typeMap, $value);
        if (!$ret) {
            $this->messenger->add(new StringType('Value has invalid type map'));
        }

        return $ret;
    }
346568
public function validateValue($value)
    {
        list($domain, $ip) = explode('/', $value, 2);
        if (($error = (new DomainValidator())->validateValue($domain)) !== null) {
            return $error;
        }
        if ($ip !== null && ($error = (new IpValidator())->validateValue($ip)) !== null) {
            return $error;
        }

        return null;
    }
923499
public function validate($value) {
        if(mb_strlen($value) > $this->max) {
            return new ValidationResult(false, sprintf('Value has to have a maximum of %d characters', $this->max));
        }        
        return new ValidationResult(true);
    }
1140104
public function validate($value) {
        return (string)$value == (string)$this->filter($value) ? $value : Filter::ERR_INVALID;
    }
153355
public function isValid($value)
    {
        $result = (boolean) filter_var($value, FILTER_VALIDATE_URL);
        if (!$result) {
            $this->addMessage('url');
        }
        return $result;
    }
879189
public function validateValue($value)
    {
        // make sure string length is limited to avoid DOS attacks
        $valid = is_string($value) && strlen($value) <= 254 && (preg_match($this->pattern, $value) || $this->allowName && preg_match($this->fullPattern, $value));
        return $valid;
    }
1233806
public function isValid($value)
    {
        if (!is_scalar($value) || !is_numeric($value)) {
            $this->error(self::INVALID);

            return false;
        }

        $length = strlen($value);

        if ($length < 9) {
            $this->error(self::TOO_SHORT);

            return false;
        }

        if ($length > 9) {
            $this->error(self::TOO_LONG);

            return false;
        }

        if (!preg_match($this->pattern, $value, $matches)) {
            $this->error(self::NO_MATCH);

            return false;
        }

        // no digit group can be all 0's
        /** @var array $matches */
        foreach ($matches as $match) {
            if (0 === (int) $match) {
                $this->error(self::NO_MATCH);

                return false;
            }
        }

        // invalid first digit groups 666 or 900-999
        /** @noinspection TypeUnsafeComparisonInspection */
        if ($matches[1] == 666 || $matches[1] >= 900) {
            $this->error(self::NO_MATCH);

            return false;
        }

        // invalid for advertisements
        if ($value >= 987654320 && $value <= 987654329) {
            $this->error(self::NO_MATCH);

            return false;
        }
        // handle famous instance of 1938
        /** @noinspection TypeUnsafeComparisonInspection */
        if ($value == '078051120') {
            $this->error(self::NO_MATCH);

            return false;
        }

        return true;
    }
390748
public function validate($value)
    {
        $return = new ValidateResult($value, false);
        $failure = null;

        if (!is_object($value)) {
            $failure = 'type';
            //error
            goto err;
        }

        $valueProperties = get_object_vars($value);

        $valuePropertiesCount = count($valueProperties);

        if ($valuePropertiesCount < $this->minProperties) {
            //error
            $failure = 'minProperties';
            goto err;
        } elseif ($this->maxProperties !== null
            && $valuePropertiesCount > $this->maxProperties
        ) {
            $failure = 'maxProperties';
            //error
            goto err;
        }

        /**
         * @param \stdClass $propertyValues
         * @param array $expression
         * @return bool
         * @throws \Exception When an unknown function is set
         */
        $evaluate = function (
            \stdClass $propertyValues,
            array $expression
        ) use (&$evaluate) {
            $functions = (object) [
                /**
                 * @return bool
                 */
                'member' => function (
                    string $operator,
                    string $propertyKey,
                    array  $memberValues
                ) use ($propertyValues) {
                    if (!property_exists($propertyValues, $propertyKey)) {
                        return false;
                    }

                    $propertyValue = $propertyValues->{$propertyKey};

                    return in_array($propertyValue, $memberValues);
                },
                /**
                 * @return bool
                 * @since 0.10.0
                 */
                'subset' => function (
                    string $operator,
                    array  $subsetValues,
                    string $propertyKey
                ) use ($propertyValues) {
                    if (!property_exists($propertyValues, $propertyKey)) {
                        return false;
                    }

                    $propertyValue = $propertyValues->{$propertyKey};

                    if (!is_array($propertyValue)) {
                        $propertyValue = [$propertyValue];
                    }

                    $propertyValue = array_unique($propertyValue);
                    $subsetValues  = array_unique($subsetValues);

                    $intersect = array_intersect($propertyValue, $subsetValues);

                    return count($subsetValues) === count($intersect);
                },
                'or' => function (
                    string $operator,
                    array ...$list
                ) use (
                    $propertyValues,
                    &$evaluate
                ) {
                    return array_reduce(
                        $list,
                        function (
                            bool $carry,
                            array $item
                        ) use (
                            $propertyValues,
                            $evaluate
                        ) {
                            return $carry || $evaluate($propertyValues, $item);
                        },
                        false
                    );
                }
            ];

            $functionKey = $expression[0];

            //is atom (bool)
            if (is_bool($functionKey)) {
                return $functionKey;
            }

            if (!isset($functions->{$functionKey})) {
                throw new \Exception(sprintf(
                    'Unknown function "%s"',
                    $functionKey
                ));
            }

            $function = $functions->{$functionKey};

            return $function(...$expression);
        };

        //validate x-visibility
        if ($this->{'x-visibility'} !== null) {
            $xVisibility = $this->{'x-visibility'};

            foreach ($xVisibility as $propertyKey => $expression) {
                if (!property_exists($value, $propertyKey)) {
                    $this->required = array_diff(
                        $this->required,
                        [$propertyKey]
                    );
                } else {
                    //evaluate if property is visible
                    $evaluation = $evaluate(
                        $value,
                        $expression
                    );

                    /*//remove from required
                    if (!$evaluation) {
                        var_dump($this->required);

                        $this->required = array_diff(
                            $this->required,
                            [$propertyKey]
                        );

                        var_dump($this->required);
                    }*/

                    //if is defined and evaluation is false throw exception
                    if (!$evaluation && isset($value->{$propertyKey})) {
                        $return->errorObject = new IncorrectParametersException([
                            'type' => static::getType(),
                            'failure' => 'x-visibility',
                            'properties' => [$propertyKey]
                        ]);

                        return $return;
                    }
                }
            }
        }

        //Check if required properties are set and find if any of them are missing
        if ($this->required !== null || !empty($this->required)) {
            //Find missing properties
            $missingProperties = [];

            foreach ($this->required as $key) {
                if (!array_key_exists($key, $valueProperties)) {
                    //Push key to missing
                    $missingProperties[] = $key;
                }
            }

            if (!empty($missingProperties)) {
                //error, missing properties
                $return->errorObject = new MissingParametersException(
                    $missingProperties
                );
                return $return;
            }
        }

        //Return default if it's empty
        if ($valuePropertiesCount === 0 && property_exists($this, 'default')) {
            $return->value = $this->default;
            $return->status = true;
            return $return;
        }

        $overallPropertyStatus = true;
        $errorObjects = [];
        $missingObjects = [];
        $missingDependencies = [];

        //Validate all validator's properties
        foreach ($this->properties as $key => $property) {
            //If this property key exists in given $value, validate it
            if (array_key_exists($key, $valueProperties)) {
                $propertyValue = $valueProperties[$key];
                $propertyValidateResult = $property->validate($propertyValue);

                //Check dependencies, if key is set, it's dependencies must also be set
                if (isset($this->dependencies->{$key})) {
                    foreach ($this->dependencies->{$key} as $dependencyKey) {
                        if (!array_key_exists($dependencyKey, $valueProperties)) {
                            $missingDependencies[] = $dependencyKey;
                            //set status to false
                            $overallPropertyStatus = false;
                        }
                    }
                }

                //Determine $overallPropertyStatus
                $overallPropertyStatus = $overallPropertyStatus && $propertyValidateResult->status;

                if (!$propertyValidateResult->status) {
                    if (!$propertyValidateResult->errorObject) {
                        $errorObjects[$key] = [];
                    } else {
                        switch (get_class($propertyValidateResult->errorObject)) {
                            case MissingParametersException::class:
                                $missingObjects[$key] = $propertyValidateResult->errorObject->getParameters();
                                break;
                            case IncorrectParametersException::class:
                                $errorObjects[$key] = $propertyValidateResult->errorObject->getParameters();
                                break;
                            default:
                                $errorObjects[$key] = [];
                        }
                    }
                }

                //use type casted value
                $value->{$key} = $propertyValidateResult->value;
            } elseif (property_exists($property, 'default')) {
                //Else use default property's value
                $value->{$key} = $property->default;
            }
        }

        if (!$overallPropertyStatus) {
            $return->status = $overallPropertyStatus;

            //error
            $errorObject = [];

            if (!empty($errorObjects)) {
                $errorObject[] = [
                 'type' => static::getType(),
                 'failure' => 'properties',
                 'properties' => $errorObjects
                ];
            }

            if (!empty($missingObjects)) {
                $errorObject[] = [
                 'type' => static::getType(),
                 'failure' => 'missing',
                 'properties' => $missingObjects
                ];
            }

            if (!empty($missingDependencies)) {
                $errorObject[] = [
                    'type' => static::getType(),
                    'failure' => 'dependencies',
                    'properties' => $missingDependencies
                ];
            }

            if (!empty($missingDependencies)) {
                $return->errorObject = new MissingParametersException(
                    $missingDependencies
                );
            } elseif (!empty($missingObjects)) {
                $return->errorObject = new MissingParametersException(
                    $missingObjects
                );
            } else {
                $return->errorObject = new IncorrectParametersException(
                    $errorObject
                );
            }

            return $return;
        }

        //Check if additionalProperties are set
        if ($this->additionalProperties === false) {
            $foundAdditionalProperties = [];

            foreach ($valueProperties as $key => $property) {
                if (!property_exists($this->properties, $key)) {
                    $foundAdditionalProperties[] = $key;
                }
            }

            if (!empty($foundAdditionalProperties)) {
                $return->errorObject = new IncorrectParametersException([[
                    'type' => static::getType(),
                    'failure' => 'additionalProperties',
                    'properties' => $foundAdditionalProperties
                ]]);
                return $return;
            }
        }

        //success
        $return->status = true;

        //Apply type casted
        $return->value = $value;

        return $this->validateCommon($value, $return);

        err:
        $return->errorObject = new IncorrectParametersException([
            'type' => static::getType(),
            'failure' => $failure
        ]);

        return $this->validateCommon($value, $return);
    }
1128505
public static function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }
        if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
            return false;
        }
        if (!isset($value['topics']) || !is_array($value['topics'])) {
            return false;
        }
        foreach ($value['topics'] as $topic) {
            if (is_array($topic)) {
                foreach ($topic as $subTopic) {
                    if (HexValidator::validate($subTopic) === false) {
                        return false;
                    }
                }
                continue;
            }
            if (HexValidator::validate($topic) === false) {
                if (!is_null($topic)) {
                    return false;
                }
            }
        }
        return true;
    }
401059
public function validate($value) : Result
    {
        return array_reduce(
            $this->restrictions,
            function ($result, $restriction) use ($value) : Result {
                if ($result->isFatal()) {
                    return $result;
                }

                return $result->concat($restriction($value));
            },
            Result::success()
        );
    }
614088
public function validate($value)
    {
        if (!is_array($value)) {
            return Error::unit([ Error::NON_ARRAY ]);
        }

        $errors = [];
        foreach ($value as $pos => $item) {
            $result = parent::validate($item);
            if ($result instanceof Error) {
                $errors[$pos] = $result->unwrap();
            }
        }

        return empty($errors) ? Ok::unit() : Error::unit($errors);
    }
1257041
public function isValueValid($value) {
		return $value instanceof Type\CreativeWork || $value instanceof Type\HowToSection || $value instanceof Type\HowToStep || $value instanceof DataType\TextType;
	}
426459
public function isValid($value)
    {
        if (is_null($value)) {
            $result = false;
            $this->error(self::NOT_NULL);
        }
        else
            $result = true;
        return $result;
   }
841269
protected function _validate($value)
    {
        $value = trim(str_replace('\\', '/', $value));
        return (is_string($value) && (preg_match(self::PATTERN, $value)) == 1);
    }