Skip to content

Commit 1aefd3d

Browse files
committed
refactor: stop reassignments
1 parent 334a44c commit 1aefd3d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

system/Helpers/url_helper.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,28 @@ function _get_uri($relativePath = '', ?App $config = null): URI
6363
$request = Services::request();
6464

6565
if ($config === null) {
66-
$url = $request instanceof CLIRequest
66+
$baseURL = $request instanceof CLIRequest
6767
? rtrim($appConfig->baseURL, '/ ') . '/'
6868
// Use the current baseURL for multiple domain support
6969
: $request->getUri()->getBaseURL();
7070

7171
$config = $appConfig;
7272
} else {
73-
$url = rtrim($config->baseURL, '/ ') . '/';
73+
$baseURL = rtrim($config->baseURL, '/ ') . '/';
7474
}
7575

7676
// Check for an index page
77+
$indexPage = '';
7778
if ($config->indexPage !== '') {
78-
$url .= $config->indexPage;
79+
$indexPage = $config->indexPage;
7980

8081
// Check if we need a separator
8182
if ($relativePath !== '' && $relativePath[0] !== '/' && $relativePath[0] !== '?') {
82-
$url .= '/';
83+
$indexPage .= '/';
8384
}
8485
}
8586

86-
$uri = new URI($url . $relativePath);
87+
$uri = new URI($baseURL . $indexPage . $relativePath);
8788

8889
// Check if the baseURL scheme needs to be coerced into its secure version
8990
if ($config->forceGlobalSecureRequests && $uri->getScheme() === 'http') {

0 commit comments

Comments
 (0)