public static function findPath(\Psr\Http\Message\ServerRequestInterface $request)
    {
        $server = $request->getServerParams();
        $path = $request->getUri()->getPath();
        if (isset($server['SCRIPT_NAME'])) {
            $basePath = dirname($server['SCRIPT_NAME']);
            if ($basePath != '/') {
                $length = strlen($basePath);
                if (substr($path, 0, $length) == $basePath) {
                    $path = substr($path, $length);
                }
            }
        }
        if ($path == '/' or $path == '') {
            return [];
        }
        if ($path[0] == '/') {
            $path = substr($path, 1);
        }
        return array_map('urldecode', explode('/', $path));
    }