Converts a scalar value in conformity with the modifiers list

@param mixed $value
@param array $modifiers
@return string
429191
private function valueModification($value, array $modifiers)
    {
        if (is_null($value)) {
            if ($modifiers['n'] || Compat::getOpt('types')) {
                return $this->implementation->reprNULL($this->connection);
            }
        }
        if ($modifiers['h']) {
            return $this->implementation->reprHexadecimal($this->connection, $value);
        }
        if ($modifiers['r']) {
            return $this->implementation->reprString($this->connection, $value);
        }
        if ($modifiers['i']) {
            return $this->implementation->reprInt($this->connection, $value);
        } elseif ($modifiers['f']) {
            return $this->implementation->reprFloat($this->connection, $value);
        } elseif ($modifiers['b']) {
            return $this->implementation->reprBool($this->connection, $value);
        }
        if (Compat::getOpt('types')) {
            $type = gettype($value);
            if ($type === 'integer') {
                return $this->implementation->reprInt($this->connection, $value);
            } elseif ($type === 'double') {
                return $this->implementation->reprFloat($this->connection, $value);
            } elseif ($type === 'boolean') {
                return $this->implementation->reprBool($this->connection, $value);
            }
        }
        return $this->implementation->reprString($this->connection, $value);
    }
131683
private function _getFloatRemainder($value, $signs = 9)
    {
        if ($value == (int)$value) {
            return '0';
        }

        $signs = min($signs, sizeof(self::$_FRACTIONS));
        $value = number_format($value, $signs, '.', '');
        list(, $remainder) = explode('.', $value);
        $remainder = preg_replace('/0+$/', '', $remainder);
        if (!$remainder) {
            $remainder = '0';
        }

        return $remainder;
    }
1069426
private function doubledModifier($value, $modifier)
	{
		if (($count = substr_count($value, $modifier)) > 0) {
			$value = $count > 1 ? str_replace($modifier . $modifier, $modifier, $value) : $value;
			if (($count % 2) > 0) {
				return [TRUE, $value];
			}
		}

		return [FALSE, $value];
	}
29010
private static function parseModifications($value)
    {
        $modifications = array();
        $matches = null;
        preg_match_all('/\(([^()]|(?R))*\)/', $value, $matches);

        foreach ($matches[0] as $modString) {
            $elements = null;
            preg_match('/\(([0-9,]+)\|([A-Z]+:[0-9]+)?\|(.*)\|?(.+)?\)/', $modString, $elements);

            $locations = explode(',', $elements[1]);
            foreach ($locations as $location) {
                $modification = new Modification();
                $modification->setLocation((int) $location);
                $modification->setName($elements[3]);
                $modification->setAccession($elements[2]);

                $modifications[] = $modification;
            }
        }

        return $modifications;
    }
1163135
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return;
        }
        $formatted = \number_format($value, 2, ',', '.');

        return $formatted;
    }
87917
private static function stringify($value)
    {
        if (is_string($value)) {
            return sprintf('"%s"', preg_replace('/\n/', '\n', $value));
        }

        if (is_bool($value)) {
            return $value ? 'true' : 'false';
        }

        if (is_null($value)) {
            return 'null';
        }

        if (is_array($value)) {
            return sprintf('[%s]', implode(', ', array_map(
                function ($value) {
                    return self::stringify($value);
                },
                $value
            )));
        }

        return (string) $value;
    }
637077
protected function coerceValue($value)
    {
        if (is_array($value) || $value instanceof \ArrayAccess) {
            return $value;
        }

        if (is_bool($value)) {
            return $this->toBool($value);
        }

        if ($value === null) {
            return static::$null;
        }

        if (is_numeric($value)) {
            return new Node\Number($value, '');
        }

        if ($value === '') {
            return static::$emptyString;
        }

        if (preg_match('/^(#([0-9a-f]{6})|#([0-9a-f]{3}))$/i', $value, $m)) {
            $color = [Type::T_COLOR];

            if (isset($m[3])) {
                $num = hexdec($m[3]);

                foreach ([3, 2, 1] as $i) {
                    $t = $num & 0xf;
                    $color[$i] = $t << 4 | $t;
                    $num >>= 4;
                }
            } else {
                $num = hexdec($m[2]);

                foreach ([3, 2, 1] as $i) {
                    $color[$i] = $num & 0xff;
                    $num >>= 8;
                }
            }

            return $color;
        }

        return [Type::T_KEYWORD, $value];
    }
20306
public function transform($value)
    {
        if (null !== $value && !is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        if ('' === $value || null === $value) {
            return null;
        }

        return [$value];
    }
1292072
public static function castString($value): string
    {
        if ($value !== null && !is_scalar($value)) {
            throw new InvalidArgumentException('Value could not be parsed to string');
        }

        return (string)$value;
    }
234189
public function value($value, $states = [])
    {
        if ($caster = $this->caster()) {
            return $caster($value, $states);
        }
        switch (true) {
            case is_null($value):
                return 'NULL';
            case is_bool($value):
                return $value ? 'TRUE' : 'FALSE';
            case is_string($value):
                return $this->quote($value);
            case is_array($value):
                $cast = function($value) use (&$cast) {
                    $result = [];
                    foreach ($value as $k => $v) {
                        if (is_array($v)) {
                            $result[] = $cast($v);
                        } else {
                            $result[] = $this->value($v);
                        }
                    }
                    return '{' . join(',', $result) . '}';

                };
                return $cast($value);
        }
        return (string) $value;
    }
92562
protected function castValueForUpdate($value)
    {
        switch ($this->type) {
            case 'string':
                $value = [(string)$value];
                break;
            case 'list':
            case 'set':
                $value = (array)$value;
                break;
            case 'zset':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $v;
                    $casted[] = $k;
                }
                $value = $casted;
                break;
            case 'hash':
                $casted = [];
                foreach ($value as $k => $v) {
                    $casted[] = $k;
                    $casted[] = $v;
                }
                $value = $casted;
                break;
            default:
                break;
        }

        return $value;
    }
741480
public function withTransformations($value) {
        // null for not provided remains untouched
        if ($value === null)
            return null;

        foreach ($this->valueTransformations as $f)
            $value = $f($value);

        return $value;
    }
868317
private static function modifierArray($modifiers = []): array {
        if (is_string($modifiers)) {
            return [$modifiers];
        }
        $array = [];
        if (is_array($modifiers)) {
            foreach ($modifiers as $key => $value) {
                if (!$value) {
                    continue;
                }
                if (is_array($value)) {
                    $array = array_merge($array, self::modifierArray($value));
                } else if (is_string($value)) {
                    $array[] = $value;
                } else if (is_string($key)) {
                    $array[] = $key;
                }
            }
        }
        return array_unique($array);
    }
253999
public static function to_type(&$value, string $type='', bool $flatten=false) {
		switch (\strtolower($type)) {
			case 'string':
				static::string($value, $flatten);
				break;
			case 'int':
			case 'integer':
				static::int($value, $flatten);
				break;
			case 'double':
			case 'float':
			case 'number':
				static::float($value, $flatten);
				break;
			case 'bool':
			case 'boolean':
				static::bool($value, $flatten);
				break;
			case 'array':
				static::array($value);
				break;
		}
	}
575033
protected function denormalizeRelation($value, $targetClass, $format, array $context)
    {
        if (null === $value || '' === $value) {
            return null;
        }

        return $this->denormalizer->denormalize($value, $targetClass, $format, $context);
    }
1046920
private function replacementE($value, array $modifiers)
    {
        if (is_array($value)) {
            throw new DataInvalidFormat('escape', 'required string');
        }
        return $this->implementation->escapeString($this->connection, $value);
    }
180954
private function decorateValue($value) : string
    {
        $ret = 'null';
        switch(gettype($value)){
            case 'string':
                $ret = $this->decorateStringValue($value);
                break;
            case 'integer':
            case 'double':
                $ret = $value;
                break;
            case 'boolean':
                $ret = $value ? 'true' : 'false';
                break;
            case 'array':
                $ret = $this->decorateArrayValue($value);
                break;
        }
        return $ret;
    }