@param AbstractSpatialType $type
@param GeometryInterface   $value

@return string
421085
public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value)
    {
        return sprintf('%s(%s)', strtoupper($value->getType()), $value);
    }
332712
protected function createAnnotation($type, $value)
    {
        if (!isset($this->annotationTypes[$type])) {
            throw new OutOfBoundsException($this->translate(
                'Invalid annotation type "{type}".',
                ['type' => $type]
            ));
        }

        return $this->getPrototype(
                $this->annotationTypes[$type],
                ['umi\form\annotation\IAnnotation']
            )
            ->createInstance([$value]);
    }
696186
public function setType(\AgentSIB\Diadoc\Api\Proto\Documents\ResolutionStatusType $value = null)
    {
        $this->Type = $value;
    }
267527
private function newObjectFromValue(AbstractSpatialType $type, $value)
    {
        $typeFamily = $type->getTypeFamily();
        $typeName   = strtoupper($value['type']);

        $constName = sprintf('CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface::%s', $typeName);

        if (! defined($constName)) {
            // @codeCoverageIgnoreStart
            throw new InvalidValueException(sprintf('Unsupported %s type "%s".', $typeFamily, $typeName));
            // @codeCoverageIgnoreEnd
        }

        $class = sprintf('CrEOF\Spatial\PHP\Types\%s\%s', $typeFamily, constant($constName));

        return new $class($value['value'], $value['srid']);
    }
107981
public function quote(string $value, int $type = \PDO::PARAM_STR): string
    {
        return $this->handler()->quote($value, $type);
    }
64917
function encodeType($value, \Plasma\ColumnDefinitionInterface $column): \Plasma\Types\TypeExtensionResultInterface {
        $type = \gettype($value);
        if($type === 'double') {
            $type = 'float';
        }
        
        if($type === 'object') {
            $classes = \array_merge(
                array(\get_class($value)),
                \class_parents($value),
                \class_implements($value)
            );
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if(\in_array($key, $classes, true)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
        foreach($this->regularTypes as $key => $encoder) {
            if($type === $key) {
                return $encoder->encode($value, $column);
            }
        }
        
        if($this->enabledFuzzySearch) {
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->regularTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        throw new \Plasma\Exception('Unable to encode given value');
    }
1040788
public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr)
    {
        if ($type instanceof GeographyType) {
            return sprintf('ST_GeographyFromText(%s)', $sqlExpr);
        }

        return sprintf('ST_GeomFromEWKT(%s)', $sqlExpr);
    }
1097121
private function convert($value, $type, array $options, array $convertCallbacks)
    {
        if (null === $value) {
            return ParameterModel::TYPE_STRING === $type ? '' : null;
        }
        if (!isset($convertCallbacks[$type])) {
            return $value;
        }

        $callback = $convertCallbacks[$type];

        return is_string($callback) ? $callback($value) : $callback($value, $options);
    }
652041
public static function trasferTypes($type, $value)
    {
        if ($value === null) {
            $value = null;
        } elseif ($type === Types::INT || $type === Types::NUMBER) {
            $value = (int)$value;
        } elseif ($type === Types::STRING) {
            $value = null === $value ? null : (string)$value;
        } elseif ($type === Types::BOOLEAN) {
            $value = (bool)$value;
        } elseif ($type === Types::FLOAT) {
            $value = (float)$value;
        }

        return $value;
    }
368552
protected function toDbType($value, $type)
    {
        switch ($type) {
            case 'int':
                return (int) $value;

            case 'bool':
                return (bool) $value;

            case 'string':
            case 'datetime': // Coverts by database
            case 'date':
            case 'float':
                return (string) $value;

            case 'array':
            case 'json':
                return json_encode((array) $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

            default:
                throw new InvalidArgumentException('Unsupported cast type: ' . $type);
        }
    }
243132
public function convertToPHPValue($value, PlatformInterface $platform)
    {
        if ($value === null) {
            return;
        }

        $val = @unserialize($value);

        if ($val === false) {
            throw TypeException::conversionToPHPFailed($value, $this->getName());
        }

        return $val;
    }
302870
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if (null === $value) {
            return null;
        }

        if (ctype_alpha($value[0])) {
            return $this->getSpatialPlatform($platform)->convertStringToPHPValue($this, $value);
        }

        return $this->getSpatialPlatform($platform)->convertBinaryToPHPValue($this, $value);
    }
279665
public function getPdoType($type, $value)
    {
        if (null === $value) {
            $type = \PDO::PARAM_NULL;
        } else {
            switch ($type) {
                case AbstractEntity::TYPE_BOOL:
                    $type = \PDO::PARAM_BOOL;
                    break;
                case AbstractEntity::TYPE_INT:
                    $type = \PDO::PARAM_INT;
                    break;
                default:
                    $type = \PDO::PARAM_STR;
            }
        }

        return $type;
    }
1204201
protected function buildUrl($type = 'email', $value)
    {
        $type = trim(strtolower($type));

        if (! in_array($type, ['ip', 'email', 'username'])) {
            throw new \InvalidArgumentException('Type of '.$type.' is not supported by the API');
        }

        $url = $this->apiUrl.'?'.$type.'='.urlencode($value).'&f=json';

        return $url;
    }
859613
public function convertToDatabaseValueSql($value, AbstractPlatform $platform)
    {
        return parent::convertToDatabaseValueSQL($value instanceof ModelInterface ? $value->pk : $value, $platform);
    }
421547
public function bindValue($parameter, $value, $type = \PDO::PARAM_STR)
    {
        list($value, $type) = TypeUtility::convertToDatabase($value, $type, $this->connection->getPlatform());

        return $this->getDriverStatement()->bindValue($parameter, $value, $type);
    }
785924
public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr)
    {
        if (! is_resource($sqlExpr)) {
            throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr));
        }

        $sqlExpr = stream_get_contents($sqlExpr);

        return parent::convertBinaryToPHPValue($type, $sqlExpr);
    }