/**
* Setup a Request object to use so that CodeIgniter
* won't try to auto-populate some of the items.
*
* @param string $method HTTP verb
*/
protected function setupRequest(string
$method, ?string
$path = null
): IncomingRequest
{ $config =
config(App::
class);
$uri =
new SiteURI($config);
// $path may have a query in it
$path = URI::
removeDotSegments($path);
$parts =
explode('?',
$path);
$path =
$parts[0
];
$query =
$parts[1
] ?? '';
$superglobals = Services::
superglobals();
$superglobals->
setServer('QUERY_STRING',
$query);
$uri->
setPath($path);