public function parseRawList(array $rawlist)
    {
        $items = [];
        $path = '';
        foreach ($rawlist as $key => $child) {
            $chunks = preg_split("/\s+/", $child);
            if (isset($chunks[8]) && ($chunks[8] == '.' or $chunks[8] == '..')) {
                continue;
            }
            if (count($chunks) === 1) {
                $len = strlen($chunks[0]);
                if ($len && $chunks[0][$len - 1] == ':') {
                    $path = substr($chunks[0], 0, -1);
                }
                continue;
            }

            // $chunks[8] and up contains filename (multiple elements if filename contains spaces)
            // up to last element or element containing '->' (if type is 'link')
            $target = '';
            $linkArrowElement = array_search('->', $chunks);
            if ($linkArrowElement !== false) {
                $filenameChunks = array_slice($chunks, 8, count($chunks) - $linkArrowElement - 1);
                $filename = implode(' ', $filenameChunks);
                $targetChunks = array_slice($chunks, $linkArrowElement + 1);
                $target = implode(' ', $targetChunks);
            } else {
                $filenameChunks = array_slice($chunks, 8);
                $filename = implode(' ', $filenameChunks);
            }

            $item = [
                'permissions' => $chunks[0],
                'number' => $chunks[1],
                'owner' => $chunks[2],
                'group' => $chunks[3],
                'size' => $chunks[4],
                'month' => $chunks[5],
                'day' => $chunks[6],
                'time' => $chunks[7],
                'name' => $filename,
                'type' => $this->rawToType($chunks[0]),
            ];
            if ($item['type'] == 'link') {
                $item['target'] = $target;
            }
            // if the key is not the path, behavior of ftp_rawlist() PHP function
            if (is_int($key) || false === strpos($key, $item['name'])) {
                array_splice($chunks, 0, 8);
                $key = $item['type'] . '#' . ($path ? $path . '/' : '') . implode(' ', $chunks);
                if ($item['type'] == 'link') {
                    // get the first part of 'link#the-link.ext -> /path/of/the/source.ext'
                    $exp = explode(' ->', $key);
                    $key = rtrim($exp[0]);
                }
                $items[$key] = $item;
            } else {
                // the key is the path, behavior of FtpClient::rawlist() method()
                $items[$key] = $item;
            }
        }

        return $items;
    }