src/PaginationFactory.php
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;
    }
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;
    }
Parses the order array.

Because of the fact that many order syntaxes use multiple query string
parameters with the same name, it is absolutely *vital* that you do not
use a `ServerRequestInterface` that has been constructed with the `$_GET`
superglobal.

The problem here is that PHP will overwrite entries in the `$_GET`
superglobal if they share the same name. With PHP, a request to
`file.php?foobar=foo&foobar=bar` will result in `$_GET` set to
`['foobar' => 'bar']`.

Other platforms, like the Java Servlet specification, allow list-like
access to these parameters. Make sure the object you pass for `$request`
has a `queryParams` property that has been created to account for
multiple query parameters with the same name. The `QueryParams` class
will produce an array that accounts for this case.

@param \Psr\Http\Message\ServerRequestInterface $request The request
@param string $sortParameter The sort parameter
@param array<string,bool> $default The default sort order
@return array<string,bool> String keys to boolean values