protected function getOrder(\Psr\Http\Message\ServerRequestInterface $request, string $sortParameter, array $default = []): array
    {
        $order = [];
        $params = $request->getQueryParams();
        if (isset($params[$sortParameter])) {
            if (isset($params[self::ORDER])) {
            // stupid Grails ordering
                $order[$params[$sortParameter]] = strcasecmp(self::DESC, $params[self::ORDER]) !== 0;
            } else {
                $param = $params[$sortParameter];
                foreach ((is_array($param) ? $param : [$param]) as $s) {
                    $this->parseSort($s, $order);
                }
            }
        } else {
            foreach (preg_grep(self::REGEX_DOJO_SORT, array_keys($params)) as $s) {
                // sort(+foo,-bar)
                $this->parseSort(substr($s, 5, -1), $order);
            }
        }
        return empty($order) ? $default : $order;
    }