Valida um dos valores passados para a entrada de dados conforme seu modelo
de estrutura de dados

@param       array $structure
Estrutura de dados que será usada para validar o valor.

@param       mixed $value
Valor que será validado.

@return      bool
196951
protected function validateCollectionTypeValue(array $structure, $value) : bool
    {
        $r = false;


        if ($structure["dataType"] === "type") {
            $nullable = (strpos($structure["structureType"], "nullable") === 0);


            if ($nullable === true && $value === null) {
                $r = true;
            } else {
                switch ($structure["internalStructure"]) {
                    case "mixed":
                        $r = true;
                        break;

                    case "?bool":
                    case "bool":
                        $r = (is_bool($value) === true);
                        break;

                    case "?int":
                    case "int":
                        $r = (is_int($value) === true);
                        break;

                    case "?float":
                    case "float":
                        $r = (is_float($value) === true);
                        break;

                    case "?string":
                    case "string":
                        $r = (is_string($value) === true);
                        break;

                    default:
                        $cname = $structure["internalStructure"];
                        $r = (is_a($value, $cname) === true || in_array($cname, class_implements($value)) === true);
                        break;
                }

                if ($r === false) {
                    $this->messageInvalidValue = "Invalid given value. Expected \"" . $this->collectionType . "\" .";
                }
            }
        } else {
            if ($structure["dataType"] === "array-of-types") {
                if (strpos($structure["structureType"], "nullable") === 0 && $value === null) {
                    $r = true;
                } elseif (is_array($value) === true && $this->isAssoc($value) === false) {
                    $childModels = $structure["childModel"];

                    foreach ($value as $i => $v) {
                        $r = $this->validateCollectionTypeValue($childModels[$i], $v);
                        if ($r === false) {
                            break;
                        }
                    }
                }
            } elseif ($structure["dataType"] === "array-assoc") {
                if (strpos($structure["structureType"], "nullable") === 0 && $value === null) {
                    $r = true;
                } elseif ($this->isAssoc($value) === true) {
                    $childModels = $structure["childModel"];
                    $key = array_keys($value)[0];
                    $val = $value[$key];

                    if (strpos($structure["structureType"], "nullable") === 0 && $val === null) {
                        $r = true;
                    } else {
                        $r = ($this->validateCollectionTypeValue($childModels[0], $key) === true &&
                            $this->validateCollectionTypeValue($childModels[1], $val) === true);
                    }
                }
            }
        }


        return $r;
    }
639751
public function isValid($value)
    {
        if (array_key_exists($value, $this->_files)) {
            $files[$value] = $this->_files[$value];
        } else {
            foreach ($this->_files as $file => $content) {
                if ($content['name'] === $value) {
                    $files[$file] = $this->_files[$file];
                }

                if ($content['tmp_name'] === $value) {
                    $files[$file] = $this->_files[$file];
                }
            }
        }

        if (empty($files)) {
            $this->_error(self::FILE_NOT_FOUND);
            return false;
        }

        foreach ($files as $file => $content) {
            $this->_value = $file;
            switch($content['error']) {
            case 0:
                if (!is_uploaded_file($content['tmp_name'])) {
                    $this->_error(self::ATTACK);
                }
                break;

            case 1:
                $this->_error(self::INI_SIZE);
                break;

            case 2:
                $this->_error(self::FORM_SIZE);
                break;

            case 3:
                $this->_error(self::PARTIAL);
                break;

            case 4:
                $this->_error(self::NO_FILE);
                break;

            case 6:
                $this->_error(self::NO_TMP_DIR);
                break;

            case 7:
                $this->_error(self::CANT_WRITE);
                break;

            case 8:
                $this->_error(self::EXTENSION);
                break;

            default:
                $this->_error(self::UNKNOWN);
                break;
            }
        }

        if (count($this->_messages) > 0) {
            return false;
        } else {
            return true;
        }
    }
924880
public function validate(
        &$value,
        \sndsgd\form\Validator $validator = null
    ): bool
    {
        $url = parse_url($value);
        if (!is_array($url)) {
            return false;
        }

        foreach ($this->requiredParts as $part) {
            if (!isset($url[$part])) {
                return false;
            }
        }

        return true;
    }
113635
public function isValueValid($value) {
		return $value instanceof Type\MonetaryAmountType || $value instanceof DataType\NumberType || $value instanceof Type\PriceSpecificationType;
	}
1117195
public function isValid($value)
    {
        if (parent::isValid($value)) {
            $this->setValue($value);

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

            return false;
        }

        return true;
    }
420289
protected function overwriteLastValueFromStructure(
        array &$structure,
        $value
    ) {
        $pointer = &$structure;
        $currentKey = key($pointer);
        $currentValue = &$pointer[$currentKey];
        while (is_array($currentValue)) {
            $pointer = &$currentValue;
            $currentKey = key($pointer);
            $currentValue = &$pointer[$currentKey];
        }

        $pointer[$currentKey] = $value;
    }
397204
public function isValid ($value)
    {
        if (!($value instanceof \Teon\Base\Text\Extractor\ExtractorInterface)) {
            $this->error(self::INVALID);
            return false;
        }
        $TextExtractor = $value;

        // Store value - all ZF2 validators do it
        $this->setValue($TextExtractor);

        \Zend\Stdlib\ErrorHandler::start();
        $status = preg_match($this->pattern, $TextExtractor->getText());
        \Zend\Stdlib\ErrorHandler::stop();

        if (false === $status) {
            $this->error(self::ERROROUS);
            return false;
        }

        if (!$status) {
            $this->error(self::NOT_MATCH);
            return false;
        }

        return true;
    }
672248
public function validateSubmitValue($values) {
        foreach ($this->_elements as $element) {
            if (method_exists($element, 'validateSubmitValue')) {
                $value = $values[$element->getName()] ?? null;
                $result = $element->validateSubmitValue($value);
                if (!empty($result) && is_string($result)) {
                    return $result;
                }
            }
        }
    }
996623
protected function compile_default_structures($value) {

        $value = preg_replace('/(?(R)\((?:[^\(\)]|(?R))*\)|(?<!\w)(\s*)@(if|foreach|for|while)(\s*(?R)+))/', '$1<?php $2 $3 { ?>', $value);
        $value = preg_replace('/(\s*)@elseif(\s*\(.*\))/', '$1<?php } elseif$2 { ?>', $value);
        $value = preg_replace('/(\s*)@(endif|endforeach|endfor|endwhile)(\s*)/', '$1<?php } ?>$3', $value);
        $value = preg_replace('/(\s*)@(end)(\s*)/', '$1<?php } ?>$3', $value);

        return $value;
    }
522783
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if (($this->_format !== null) or ($this->_locale !== null)) {
            include_once 'Zend/Date.php';
            if (!Zend_Date::isDate($value, $this->_format, $this->_locale)) {
                if ($this->_checkFormat($value) === false) {
                    $this->_error(self::FALSEFORMAT);
                } else {
                    $this->_error(self::INVALID);
                }
                return false;
            }
        } else {
            if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $valueString)) {
                $this->_error(self::NOT_YYYY_MM_DD);
                return false;
            }

            list($year, $month, $day) = sscanf($valueString, '%d-%d-%d');

            if (!checkdate($month, $day, $year)) {
                $this->_error(self::INVALID);
                return false;
            }
        }

        return true;
    }
587879
protected function validatorValue($value)
    {
        if (!$value) {
            return $this->allowEmpty;
        }

        $pattern = str_replace('{schemes}', '(' . implode('|', $this->validSchemes) . ')', $this->pattern);
        if (preg_match($pattern, $value)) {
            return true;
        }

        return false;
    }
403737
public static function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }
        if (
            isset($value['fromBlock']) &&
            QuantityValidator::validate($value['fromBlock']) === false &&
            TagValidator::validate($value['fromBlock']) === false
            ) {
            return false;
        }
        if (
            isset($value['toBlock']) &&
            QuantityValidator::validate($value['toBlock']) === false &&
            TagValidator::validate($value['toBlock']) === false
            ) {
            return false;
        }
        if (isset($value['address'])) {
            if (is_array($value['address'])) {
                foreach ($value['address'] as $address) {
                    if (AddressValidator::validate($address) === false) {
                        return false;
                    }
                }
            } elseif (AddressValidator::validate($value['address']) === false) {
                return false;
            }
        }
        if (isset($value['topics']) && is_array($value['topics'])) {
            foreach ($value['topics'] as $topic) {
                if (is_array($topic)) {
                    foreach ($topic as $v) {
                        if (isset($v) && HexValidator::validate($v) === false) {
                            return false;
                        }
                    }
                } else {
                    if (isset($topic) && HexValidator::validate($topic) === false) {
                        return false;
                    }
                }
            }
        }
        return true;
    }
693172
private function valid($types, $value) {
        $types = (array) $types;

        foreach($types as $type) {
            switch($type) {
            case self::T_NULL:
                if(is_null($value)) {
                    return true;
                }
                break;
            case self::T_INT:
                if(is_int($value)) {
                    return true;
                }
                break;
            case self::T_STR:
                if(is_string($value)) {
                    return true;
                }
                break;
            case self::T_ARR:
                if(is_array($value)) {
                    return true;
                }
                break;
            }
        }

        return false;
    }
37397
protected function isValid($value): bool
    {
        $type = gettype($value);
        switch ($type) {
            case 'string':
            case 'integer':
            case 'double':
            case 'boolean':
            case 'NULL':
                return true;
                break;
            case 'array':
                return ArrayCollection::create($value)->every(function ($v) {
                    return $this->isValid($v);
                });
                break;
            default:
                break;
        }

        return false;
    }
283749
public function validate($value)
    {
        if (!$value instanceof DOMDocument) {
            $this->errors[] = TypeValidationError::xmlValidationFailed('Expected value of type DOMDocument');

            return;
        }

        $originalErrorLevel = \libxml_use_internal_errors(true);
        $value->schemaValidateSource($this->xml);
        $errors = \libxml_get_errors();
        \libxml_clear_errors();
        if ($errors) {
            foreach ($errors as $error) {
                $this->errors[] = TypeValidationError::xmlValidationFailed($error->message);
            }

            return;
        }

        \libxml_use_internal_errors($originalErrorLevel);
    }
370482
public function isValueValid($value) {
		return $value instanceof Type\Enumeration || $value instanceof Type\PropertyValue || $value instanceof Type\QualitativeValue || $value instanceof Type\QuantitativeValue || $value instanceof Type\StructuredValue;
	}
123457
public function isValid($value)
    {
        $query = (new \Cms\Orm\CmsFileQuery)
            ->byObject($this->_getObjectName(), $this->getObjectId());
        if ($this->getClass()) {
            $query->andFieldClass()->equals($this->getClass());
        }
        if ($this->getActive() !== null) {
            $query->andFieldActive()->equals($this->getActive());
        }
        if (!$query->count()) {
            $this->_error(self::INVALID);
            return false;
        }
        return true;
    }