Translate the raw input from a parameter to something usable.
@param $value
@return mixed
13823
public function toParameterValue($value)
    {
        if ($value === null) {
            return null;
        }

        $format = $this->formatIn ?? $this->format;
        return \DateTime::createFromFormat($format, $value);
    }
946400
protected function parseDate($value)
    {
        // Skip empty values
        if (empty($value) && !is_numeric($value)) {
            return null;
        }

        // Determine value to parse
        if (is_array($value)) {
            $source = $value; // parse array
        } elseif (is_numeric($value)) {
            $source = $value; // parse timestamp
        } else {
            // Convert US date -> iso, fix y2k, etc
            $value = $this->fixInputDate($value);
            if (is_null($value)) {
                return null;
            }
            $source = strtotime($value); // convert string to timestamp
        }
        if ($value === false) {
            return false;
        }

        // Format as iso8601
        $formatter = $this->getInternalFormatter();
        return $formatter->format($source);
    }
1330493
private function decodeNonTranslatableCharacters(string $value): string
    {
        return str_replace(
            array_values($this->nonTranslatableCharactersHashMap),
            array_keys($this->nonTranslatableCharactersHashMap),
            $value
        );
    }
910137
public function filter($value)
    {
        if (!is_scalar($value)) {
            return $value;
        }

        $value = (string)$value;

        if ($this->options['encoding'] !== null) {
            $string = mb_strtolower($value, $this->options['encoding']);
            $upper = mb_strtoupper($string, $this->options['encoding']);
            preg_match('#(.)#us', $upper, $matches);
            $string = $matches[1] . mb_substr($string, 1, mb_strlen($string, $this->options['encoding']), $this->options['encoding']);
            return $string;
        }

        return ucfirst(strtolower($value));
    }
204211
public function _prepValues($value)
    {
        if (is_array($value)) {
            if (isset($value["func"])) {
                return $value["func"];
            }
            foreach ($value as &$param) {
                $this->params[] = $param;
                $param = "?";
            }
            unset($param);
            return $value;
        }
        if (in_array(is_string($value) ? strtolower($value) : $value, [null, "null"]) === false) {
            $this->params[] = $value;
            $value = "?";
        }
        return $value;
    }
133458
protected function processScalarValue($value)/*# : string */
    {
        if (ClauseInterface::NO_VALUE == $value) {
            return '?';
        } elseif (is_null($value) || is_bool($value)) {
            return strtoupper(var_export($value, true));
        } else {
            return $this->getBuilder()->getParameter()->getPlaceholder($value);
        }
    }
445990
protected function parseAsTranslatable($value)
    {
        trigger_error('parseAsTranslatable() is deprecated. Use Translator::translation() instead.', E_USER_DEPRECATED);

        $value = $this->translator()->translation($value);

        return $value === null ? '' : $value;
    }
1139999
public function getTransformedValue($value)
    {
        if(is_scalar($value) || (is_object($value) && method_exists($value, '__toString'))) {
            foreach($this->regex as $regex => $replace) {

                if(preg_match($regex, (string)$value))
                    return preg_replace($regex, $replace, $value);
            }
        }

       return $value;
    }
1111454
public function filter($value)
        {
            // transliteration
            $value = strtr($value, $this->transliteration);

            // change to lowercase
            if($this->transformCase) {
                $value = mb_convert_case($value, MB_CASE_LOWER, 'utf8');
            }

            // replace punctuation
            if($this->transformPunctuation) {
                $value = strtr($value, $this->punctuation);
            }

            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;
    }
549793
public static function fromValue($value)
    {
        try {
            return array_search(strtoupper($value), $this->modeList);
        } catch (Exception $e) {
            return null;
        }
    }
720295
public function decode($value)
    {
        if (is_array($value)) {
            $newValue = array();
            foreach ($value as $key => $val) {
                $newValue[$key] = html_entity_decode($val, ENT_QUOTES, 'UTF-8');
            }

            return $newValue;
        }

        return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
    }
87800
private function _toType($value) {
        if ($value === '') {
            return "";
        }
        $first_character = $value[0];
        $last_character = substr($value, -1, 1);

        $is_quoted = false;
        do {
            if (!$value) {
                break;
            }
            if ($first_character != '"' && $first_character != "'") {
                break;
            }
            if ($last_character != '"' && $last_character != "'") {
                break;
            }
            $is_quoted = true;
        } while (0);

        if ($is_quoted) {
            $value = str_replace('\n', "\n", $value);
            if ($first_character == "'") {
                return strtr(substr($value, 1, -1), array('\'\'' => '\'', '\\\'' => '\''));
            }
            return strtr(substr ($value, 1, -1), array ('\\"' => '"', '\\\''=> '\''));
        }

        if (strpos($value, ' #') !== false && !$is_quoted)
            $value = preg_replace('/\s+#(.+)$/','',$value);

        if ($first_character == '[' && $last_character == ']') {
            // Take out strings sequences and mappings
            $innerValue = trim(substr ($value, 1, -1));
            if ($innerValue === '') {
                return array();
            }
            $explode = $this->_inlineEscape($innerValue);
            // Propagate value array
            $value  = array();
            foreach ($explode as $v) {
                $value[] = $this->_toType($v);
            }
            return $value;
        }

        if (strpos($value,': ')!==false && $first_character != '{') {
            $array = explode(': ',$value);
            $key   = trim($array[0]);
            array_shift($array);
            $value = trim(implode(': ',$array));
            $value = $this->_toType($value);
            return array($key => $value);
        }

        if ($first_character == '{' && $last_character == '}') {
            $innerValue = trim(substr ($value, 1, -1));
            if ($innerValue === '') {
                return array();
            }
            // Inline Mapping
            // Take out strings sequences and mappings
            $explode = $this->_inlineEscape($innerValue);
            // Propagate value array
            $array = array();
            foreach ($explode as $v) {
                $SubArr = $this->_toType($v);
                if (empty($SubArr)) {
                    continue;
                }
                if (is_array ($SubArr)) {
                    $array[key($SubArr)] = $SubArr[key($SubArr)]; 
                    continue;
                }
                $array[] = $SubArr;
            }
            return $array;
        }

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

        if ( is_numeric($value) && preg_match ('/^(-|)[1-9]+[0-9]*$/', $value) ){
            $intvalue = (int)$value;
            if ($intvalue != PHP_INT_MAX) {
                $value = $intvalue;
            }
            return $value;
        }

        if (is_numeric($value) && preg_match('/^0[xX][0-9a-fA-F]+$/', $value)) {
            // Hexadecimal value.
            return hexdec($value);
        }

        $this->coerceValue($value);

        if (is_numeric($value)) {
            if ($value === '0') {
                return 0;
            }
            if (rtrim ($value, 0) === $value) {
                $value = (float)$value;
            }
            return $value;
        }

        return $value;
    }
1023443
protected function substituteConstantTemplates($value) {
        $lines = array();
        foreach(explode(PHP_EOL, $value) as $line) {
            $quote = substr(trim($line), 0, 1);
            $line = preg_replace_callback(
                '~{([\w]+)}~',
                function($matches) use ($quote) {
                    $matches[1] = $quote . '.' . $matches[1] . '.' . $quote;
                    return $matches[1];
                },
                $line
            );
            $lines[] = str_replace(array($quote.$quote . '.', '.' . $quote.$quote), '', $line);
        }
        return implode(PHP_EOL, $lines);
    }
1088630
public function checkParamSpecialChars(&$value, $raw = null)
    {
        return Registry::get(\OxidEsales\Eshop\Core\Request::class)->checkParamSpecialChars($value, $raw);
    }
252131
public function filter($value)
    {
        if ($this->toEncoding === null) {
            return $value;
        }

        if ($this->fromEncoding === null) {
            return mb_convert_encoding($value, $this->toEncoding);
        }

        return mb_convert_encoding($value, $this->toEncoding, $this->fromEncoding);
    }
707751
protected function toScalar($value)
    {
        if (is_scalar($value)) {
            return $value;
        } elseif (null === $value) {
            return 'NULL';
        } else {
            if (is_object($value)) {
                if (is_callable([$value, '__toString'])) {
                    return (string) $value;
                } elseif ($value instanceof \DateTimeInterface) {
                    return $value->format('Y-m-d H:i:s');
                } else {
                    throw new \InvalidArgumentException(sprintf("Cast of class %s is impossible", get_class($value)));
                }
            } else {
                throw new \InvalidArgumentException(sprintf("Cast of type %s is impossible", gettype($value)));
            }
        }
    }