@param string|array $value

@return string|array
428167
protected function prepareValue($value)
    {
        $params = $this->getOperatorParams();
        $method = $params['method'];
        switch ($method) {
            case 'where':
            case 'whereNull':
            case 'whereNotNull':
                break;
            case 'whereBetween':
            case 'whereNotBetween':
                if (! is_array($value)) {
                    $value = explode(',', $value, 2);
                }
                break;
            case 'whereIn':
            case 'whereNotIn':
                if (! is_array($value)) {
                    $value = explode(',', $value);
                }
                break;
        }

        return $value;
    }
1286349
protected function encodeArray(array $value)
    {
        $text = '';
        foreach ($value as $key => $value) {
            $value = (string) $value;
            $value = trim($value);

            $text .= "\n\t" . ucfirst($key) . ': ' . str_replace("\n", "\n\t\t", $value);
        }

        return $text;
    }
608874
protected function normalizeValue($value)
    {
        if (is_array($value)) {
            $value = $this->normalizeArray($value);
        } elseif (is_bool($value)) {
            $value = $this->normalizeBoolean($value);
        } elseif (is_null($value)) {
            $value = 'null';
        } elseif (is_string($value) && $this->checkFlag(self::STRING_MODE_QUOTE)) {
            $value = sprintf('"%s"', $value);
        }

        return $value;
    }
339158
public static function cleanValue($value)
    {
        if (is_array($value)) {
            $new_value = [];

            foreach ($value as $k => $v) {
                $new_value[$k] = self::cleanValue($v);
            }

            return $new_value;
        }

        return stripslashes($value);
    }
521595
protected function serializedArray(array $value)
    {
        unset($value[Serializer::MAP_TYPE]);

        $dataValues = [];
        $includedValues = [];

        foreach ($value[Serializer::SCALAR_VALUE] as $v) {
            $v = $this->serializeObject($v);
            $dataValues[] = $v[self::DATA_KEY];
            if (!empty($v[self::INCLUDED_KEY])) {
                $includedValues = \array_merge($includedValues, $v[self::INCLUDED_KEY]);
            }
        }
        $includedValues = \array_unique($includedValues, SORT_REGULAR);

        $data[self::DATA_KEY] = $dataValues;
        $data[self::INCLUDED_KEY] = \array_values($includedValues);
        $data = array_filter($data);

        $this->setResponseLinks($value, $data);
        $this->setResponseMeta($data);
        $this->setResponseVersion($data);
        $this->setResponseMeta($data);

        return (empty($data['data'])) ? array_merge(['data' => []], $data) : $data;
    }
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;
    }
1043499
static public function stripslashes($value) 
    {
        if(!is_array($value)) {
            return stripslashes($value);
        }
        foreach($value as $key => $val) {
            $value[$key] = static::stripslashes($val);
        }
        return $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;
    }
189818
public function makeStorableArrayFieldValue($value)
    {
        if ($this->_isEncodedArrayFieldValue($value)) {
            $value = $this->_decodeArrayFieldValue($value);
        }

        $value = $this->_serializeValue($value);
        return $value;
    }
1159646
public function marshal($value)
    {
        if (is_array($value) || $value === null) {
            return $value;
        }

        return json_decode($value, true);
    }
993163
public function filter($value)
    {
        if (!is_array($value)) {
            $ascii = new \Mmi\Filter\Ascii;
            return preg_replace('!\-+!', '-', preg_replace('/[^\p{L}\p{N}]/u', '-', strtolower(trim($ascii->filter($value), '-'))));
        }
        foreach ($value as $key => $val) {
            $value[$key] = $this->filter($val);
        }
        return $value;
    }
1048818
public function utf8Value($value)
    {
        if (is_array($value)) {
            return $this->utf8AllTheThings($value);
        }

        return StringHelper::convertToUtf8($value);
    }
632821
private function ensureString($value)
    {
        if (is_string($value)) {
            return $value;
        }

        if (is_array($value) || $value instanceOf \Traversable) {
            $string = array();
            foreach ($value as $val) {
                if (is_object($val) && method_exists($val, '__toString')) {
                    $string[] = $val->__toString();
                }
                else {
                    $string[] = (string) $val;
                }
            }
            return implode(',', $string);
        }

        if (is_object($value) && method_exists($value, '__toString')) {
            return $value->__toString();
        }
    }
204551
public function serialize($value): string
    {
        if (is_array($value)) {
            return $this->packArray($value);
        }

        return $this->packValue($value);
    }
1046176
public function filter($value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            return $value;
        }

        // a unicode safe way of converting characters to \x00\x00 notation
        $pregQuotedSeparator = preg_quote($this->separator, '#');

        if (StringUtils::hasPcreUnicodeSupport()) {
            $patterns = [
                '#(' . $pregQuotedSeparator.')(\P{Z}{1})#u',
                '#(^\P{Z}{1})#u',
            ];
            if (!extension_loaded('mbstring')) {
                $replacements = [
                    function ($matches) {
                        return strtoupper($matches[2]);
                    },
                    function ($matches) {
                        return strtoupper($matches[1]);
                    },
                ];
            } else {
                $replacements = [
                    function ($matches) {
                        return mb_strtoupper($matches[2], 'UTF-8');
                    },
                    function ($matches) {
                        return mb_strtoupper($matches[1], 'UTF-8');
                    },
                ];
            }
        } else {
            $patterns = [
                '#(' . $pregQuotedSeparator.')([\S]{1})#',
                '#(^[\S]{1})#',
            ];
            $replacements = [
                function ($matches) {
                    return strtoupper($matches[2]);
                },
                function ($matches) {
                    return strtoupper($matches[1]);
                },
            ];
        }

        $filtered = $value;
        foreach ($patterns as $index => $pattern) {
            $filtered = preg_replace_callback($pattern, $replacements[$index], $filtered);
        }
        return $filtered;
    }
1104365
public function filter($value)
    {
        if (null === $value) {
            return null;
        }
        $this->checkValueIsArrayOrThrowException($value);

        $return = [];
        foreach ($value as $header => $condition) {
            $return[$header] = $this->conditionFilter->filter($condition);
        }

        return $return;
    }
1145782
private function prepareValue($value)
    {
        if (is_array($value)) {
            foreach ($value as &$val) {
                if (is_array($val) and count($val) === 1) {
                    $val = array_shift($val);
                }
            }
            unset($val);

            if (count($value) === 1) {
                $value = array_shift($value);
            }
        }

        return $value;
    }