Decode single string of data
Generally is used when decoding response from database

@param string $row
@return array
420621
public function decode(string $row): array
    {
        $stream = fopen('php://memory', 'r+');
        fputs($stream, $row);
        rewind($stream);
        $result = [];
        $names = fgetcsv($stream, 0, "\t");
        if (empty($names) === true) {
            throw new \RuntimeException('failed decoding names from response');
        }
        while(($row = fgetcsv($stream, 0, "\t")) !== false) {
            $result[] = array_combine($names, $row);
        }
        fclose($stream);
        return $result;
    }
292769
private function getHeadersFromRow(array $row): array
    {
        $headers = [];

        if (isset($row['headers'])) {
            if (isset($row['headers']) && is_array($row['headers'])) {
                return $row['headers'];
            }

            if (class_exists(Header::class)) {
                // pecl_http versions 2.x/3.x
                $headers = Header::parse($row['headers']);
            } elseif (function_exists('\http_parse_headers')) {
                // pecl_http version 1.x
                $headers = \http_parse_headers($row['headers']);
            } elseif (0 === mb_strpos($row['headers'], 'User-Agent: ')) {
                $headers = ['user-agent' => str_replace('User-Agent: ', '', $row['headers'])];
            } else {
                return [];
            }
        }

        if (is_array($headers)) {
            return $headers;
        }

        return [];
    }
1181187
public function decode($data)
    {
        $data = (string) $data;
        // skip empty strings (that cause "Syntax error"?)
        if ($data === '') {
            return null;
        }

        $data = json_decode($data, $this->options['assoc'], $this->options['depth'],
            $this->options['flags']);
        if (json_last_error() > 0) {
            $data = null;
            $this->error = json_last_error_msg() ?: 'Unknown';
        }

        return $data;
    }
872316
public static function convertToArray($row)
    {
        $data = $row instanceof Arrayable ? $row->toArray() : (array) $row;

        foreach ($data as &$value) {
            if (is_object($value) || is_array($value)) {
                $value = self::convertToArray($value);
            }

            unset($value);
        }

        return $data;
    }
891544
public function loadVersionedNameData($rows)
    {
        $query = $this->queryBuilder->createNamesQuery();
        $conditions = array();
        foreach ($rows as $row) {
            $conditions[] = $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentobject_id'),
                    $query->bindValue($row['id'], null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('content_version'),
                    $query->bindValue($row['version'], null, \PDO::PARAM_INT)
                )
            );
        }

        $query->where($query->expr->lOr($conditions));
        $stmt = $query->prepare();
        $stmt->execute();

        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
    }
784066
protected function decodeData(array $data)
    {
        $result = [];

        if (is_array($data[0])) {
            foreach ($data[0] as $k => $v) {
                $result[$k] = $this->decodeData([$data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]]);
            }

            return $result;
        }

        return [
            'name' => $data[0],
            'type' => $data[1],
            'tmp_name' => $data[2],
            'error' => $data[3],
            'size' => $data[4],
        ];
    }
551968
protected function sanitiseRow($table, $row)
    {
        $data = [];

        foreach ($this->keys[$table] as $key) {
            $data[$key] = isset($row[$key]) ? $row[$key] : null;
        }

        return $data;
    }
914734
public static function decode_response($response)
    {
        if (!$response) {
            return PASSWORD_CONNECT_ERROR;
        }

        // $result should be `null` or `stdClass` object
        $result = json_decode($response);

        // The UAPI may return HTML instead of JSON on missing authentication
        if ($result && $result->status === 1) {
            return PASSWORD_SUCCESS;
        }

        if ($result && is_array($result->errors) && count($result->errors) > 0) {
            return array(
                'code'    => PASSWORD_ERROR,
                'message' => $result->errors[0],
            );
        }

        return PASSWORD_ERROR;
    }
174239
protected static function transformRow($row)
    {
        foreach ($row as $key => $value) {
            if ($value instanceof DateTime) {
                $row[$key] = $value->format('Y-m-d H:i:s');
            } else {
                if (is_object($value)) {
                    $row[$key] = (string) $value;
                } else {
                    $row[$key] = $value;
                }
            }
        }

        return $row;
    }
717930
private function getFilteredRow($row)
    {
        $newRow = array();

        foreach ($row as $column => $value) {
            if (in_array($column, $this->columns)) {
                $newRow[$column] = $value;
            }
        }

        return $newRow;
    }
238364
public function decode($data)
    {
        $decoded = @unserialize($data, $this->getOptions());

        if ($decoded === false && $data !== serialize(false)) {
            throw new \RuntimeException('Decoding serialized data failed');
        }

        return $this->preserveLines($decoded, ['\\n', '\\r'], ["\n", "\r"]);
    }
1221843
public static function decodeArray(String $data, Int $length = 512) : Array
    {
        return (array) json_decode($data, true, $length);
    }
593971
private function decode($data, $raw)
    {
        if (is_array($data)) {
            foreach ($data as $k => &$v) {
                $v = $this->decode($v, $raw[$k]);
            }
            return $data;
        }

        $data = $this->decodeBoolean($data, $raw);
        $data = $this->decodeNull($data, $raw);

        if (is_numeric($data) && ((string)($data + 0) === $data))
            return $data + 0;

        if (is_string($raw) && empty($raw))
            return "";

        return $data;
    }
35539
protected function cleanupRow($row)
    {
        foreach ($row as $key => $column) {
            if ($this->isQuoted($column)) {
                $column = $this->unescape($this->unquote($column));
            }
            if ($this->isSerialized($column)) {
                $column = $this->unserialize($column);
            }
            if ('N;' === $column) {
                $column = null;
            }
            $row[$key] = $column;
        }

        return $row;
    }
1279609
private function readRow() : ?array
    {
        $row = @ fgetcsv($this->handle, 0, $this->delimiter, $this->enclosure, $this->escape);

        if ($row === false || $row === null) {
            return null;
        }

        if ($row[0] === null) {
            return [];
        }

        return $row;
    }
383749
private function readRow() : ?array
    {
        $line = @ fgets($this->handle);

        if ($line === false) {
            return null;
        }

        $data = @ json_decode('[' . $line . ']');

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \RuntimeException(json_last_error_msg());
        }

        return $data;
    }
1046282
public function decodeData($data)
    {
        $output = array();
        while (strlen($data) > 0) {
            preg_match('/(\w+)(\[(\d+)\])?=/', $data, $matches);
            $key = $matches[1];
            $data = substr($data, strlen($matches[0]));

            if (isset($matches[3])) {
                $value = substr($data, 0, $matches[3]);
            } else {
                $next = strpos($data, '&');
                $value = $next === false ? $data : substr($data, 0, $next);
            }

            $data = substr($data, strlen($value) + 1);
            $output[$key] = $value;
        }

        return $output;
    }