@param $value
@param IValidationData $data

@return bool
19896
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            $value = trim($value);
        }

        return ! empty($value);
    }
1219509
protected static function isValidValue(TypeInterface $type, $value)
    {
        if ($type instanceof NonNullModifier) {
            if (NULL === $value) {
                return FALSE;
            }

            return self::isValidValue($type->getWrappedType(), $value);
        }

        if ($value === NULL) {
            return TRUE;
        }

        if ($type instanceof ListModifier) {
            $itemType = $type->getWrappedType();
            if (is_array($value)) {
                foreach ($value as $item) {
                    if (!self::isValidValue($itemType, $item)) {
                        return FALSE;
                    }
                }

                return TRUE;
            } else {
                return self::isValidValue($itemType, $value);
            }
        }

        if ($type instanceof InputObjectType) {
            $fields = $type->getFields();
            foreach ($fields as $fieldName => $field) {
                if (!self::isValidValue($field->getType(), isset($value[$fieldName]) ? $value[$fieldName] : NULL)) {
                    return FALSE;
                }
            }

            return TRUE;
        }

        if ($type instanceof ScalarType || $type instanceof EnumType) {
            return NULL !== $type->coerce($value);
        }

        return FALSE;
    }
1265245
public function acceptsValue($value): bool {
		switch ($this->operator) {
			case CriteriaComparator::OPERATOR_NOT_IN:
				if ($value === null) return true;
				return !$this->in($value);
			case CriteriaComparator::OPERATOR_IN:
				if ($value === null) return false;
				return !$this->in($value);
				
			case CriteriaComparator::OPERATOR_CONTAINS_NOT:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if ($this->in($relationEntry)) return false;
				}
				
				return true;
			case CriteriaComparator::OPERATOR_CONTAINS:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if (!$this->in($relationEntry)) return false;
				}
				
				return true;
		}
	}
720834
public function assign($data, $value = null) {
        if (is_array($data)) {
            $this->data = array_merge($this->data, $data);
        } else if ($data) {
            $this->data [ $data ] = $value;
        }

        return $this;
    }
505905
public function isValueValid($value) {
		return $value instanceof Type\DataFeedItemType || $value instanceof DataType\TextType || $value instanceof Type\ThingType;
	}
620568
public static function register($key, $value, $data = [])
    {
        if (!self::_tableExists()) {
            return;
        }

        self::autoLoad();

        $_data = [
            'value' => $value,
            'editable' => 1,
            'autoload' => true,
            'options' => [],
            'description' => null,
        ];

        $data = array_merge($_data, $data);

        // Don't overrule because we register
        $data['overrule'] = false;

        self::options($key, $data['options']);

        self::write($key, $data['value'], $data);
    }
609777
public function setValue($value, $data = null)
    {
        // Save raw value for later validation
        $this->rawValue = $value;

        // Null case
        if (!$value) {
            $this->value = null;
            return $this;
        }

        // Re-run through formatter to tidy up (e.g. remove time component)
        $this->value = $this->tidyInternal($value);
        return $this;
    }
39468
protected function setDataValue($data, $field, $value)
    {
        if (!isset($this->dataNamesMap[$field]['set'])) {

            if (true === $this->ignoreNotMappedFields) {
                return $this;
            }

            throw new \DomainException('Field have not mapping with Data instance (field: ' . $field . ')');
        }

        $method = $this->dataNamesMap[$field]['set'];

        $data->{$method}($value);

        return $this;
    }
234697
public function setValue($value, $data = null)
    {
        if ($data instanceof DataObject) {
            $this->loadFrom($data);
            return $this;
        }
        
        return parent::setValue($value);
    }
1110226
public static function isOptionalExistingValue($value, array $values)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredExistingValue($value, $values);
    }
1033112
public function check($value, IValidationData $data = null) {
        if (is_scalar($value)) {
            return preg_match('/^[[:alnum:]]+$/u', $value) === 1;
        }

        return false;
    }
1203627
public static function implementsInterface($value, string $interface): bool
    {
        if (!is_object($value)) {
            if (!(static::classExists($value) || static::interfaceExists($value))) {
                return false;
            }
            $value = (string) $value;
        }

        $reflection = new ReflectionClass($value);

        return $reflection->implementsInterface($interface);
    }
360606
protected function isValidValue($value)
    {
        $valid = true;
        if (is_array($value)) {
            $numericKeys = 0;
            foreach ($value as $k => $v) {
                $numericKeys += is_integer($k);
                if (!$this->isValidValue($v)) {
                    $valid = false;
                    break;
                }
            }
            if (!($numericKeys == 0 || $numericKeys == count($value))) {
                $valid = false;
            }
        } else {
            if (null !== $value && !is_scalar($value)) {
                $valid = false;
            }
        }
        return $valid;
    }
1308826
public function containsValuesEqualToVariableDefaultOnly()
    {
        $data = $this->getDataPlaceHolder();
        
        foreach ($data as $variable) {
            $value = $variable->getValue();
            $default = $variable->getDefaultValue();
            
            if (Utils::isNull($value) === true) {
                if (Utils::isNull($default) === false) {
                    return false;
                }
            } elseif ($value->equals($default) === false) {
                return false;
            }
        }
        
        return true;
    }
450467
public function isValueValid($value) {
		return $value instanceof Type\QualitativeValueType || $value instanceof DataType\TextType || $value instanceof DataType\URLType;
	}
776556
public function setValue($value, $data = null)
    {
        // Check Provided Value:
        
        if ($value && $this->isValidValue($value)) {
            return parent::setValue($value, $data);
        }
        
        // Default to Locale (if enabled):
        
        if ($this->config()->default_to_locale) {
            
            if (($code = $this->getCountryFromLocale()) && $this->isValidValue($code)) {
                return parent::setValue($code, $data);
            }
            
        }
        
        // Default to Country (if defined):
        
        if (($code = strtolower($this->config()->default_country)) && $this->isValidValue($code)) {
            return parent::setValue($code, $data);
        }
        
        // Answer Self:
        
        return $this;
    }
135964
protected function lt($value, $rule, $data)
    {
        $val = $this->getDataValue($data, $rule);

        return !is_null($val) && $value < $val;
    }