@@ -53,26 +53,10 @@ class SiteURI extends URI
5353 * 1 => 'public',
5454 * 2 => 'index.php',
5555 * ];
56- */
57- private array $ baseSegments ;
58-
59- /**
60- * List of URI segments after indexPage.
61- *
62- * The word "URI Segments" originally means only the URI path part relative
63- * to the baseURL.
64- *
65- * If the URI is "http://localhost:8888/ci431/public/index.php/test?a=b",
66- * and the baseURL is "http://localhost:8888/ci431/public/", then:
67- * $segments = [
68- * 0 => 'test',
69- * ];
7056 *
71- * @var array<int, string>
72- *
73- * @deprecated 4.4.0 This property will be private.
57+ * @var list<string>
7458 */
75- protected $ segments ;
59+ private array $ baseSegments ;
7660
7761 /**
7862 * URI path relative to baseURL.
@@ -149,9 +133,9 @@ private function determineBaseURL(
149133
150134 // Update scheme
151135 if ($ scheme !== null && $ scheme !== '' ) {
152- $ uri-> setScheme ($ scheme );
136+ $ uri = $ uri -> withScheme ($ scheme );
153137 } elseif ($ configApp ->forceGlobalSecureRequests ) {
154- $ uri-> setScheme ('https ' );
138+ $ uri = $ uri -> withScheme ('https ' );
155139 }
156140
157141 // Update host
@@ -219,26 +203,10 @@ private function setBasePath(): void
219203 }
220204 }
221205
222- /**
223- * @deprecated 4.4.0
224- */
225- public function setBaseURL (string $ baseURL ): void
226- {
227- throw new BadMethodCallException ('Cannot use this method. ' );
228- }
229-
230- /**
231- * @deprecated 4.4.0
232- */
233- public function setURI (?string $ uri = null )
234- {
235- throw new BadMethodCallException ('Cannot use this method. ' );
236- }
237-
238206 /**
239207 * Returns the baseURL.
240208 *
241- * @interal
209+ * @internal
242210 */
243211 public function getBaseURL (): string
244212 {
@@ -298,23 +266,21 @@ private function setRoutePath(string $routePath): void
298266 }
299267
300268 /**
301- * Converts path to segments
269+ * @return list<string>
302270 */
303271 private function convertToSegments (string $ path ): array
304272 {
305273 $ tempPath = trim ($ path , '/ ' );
306274
307- return ( $ tempPath === '' ) ? [] : explode ('/ ' , $ tempPath );
275+ return $ tempPath === '' ? [] : explode ('/ ' , $ tempPath );
308276 }
309277
310278 /**
311279 * Sets the path portion of the URI based on segments.
312280 *
313281 * @return $this
314- *
315- * @deprecated 4.4.0 This method will be private.
316282 */
317- public function refreshPath ()
283+ protected function refreshPath (): self
318284 {
319285 $ allSegments = array_merge ($ this ->baseSegments , $ this ->segments );
320286 $ this ->path = '/ ' . $ this ->filterPath (implode ('/ ' , $ allSegments ));
@@ -364,11 +330,7 @@ protected function applyParts(array $parts): void
364330 $ this ->fragment = $ parts ['fragment ' ];
365331 }
366332
367- if (isset ($ parts ['scheme ' ])) {
368- $ this ->setScheme (rtrim ($ parts ['scheme ' ], ':/ ' ));
369- } else {
370- $ this ->setScheme ('http ' );
371- }
333+ $ this ->scheme = $ this ->withScheme ($ parts ['scheme ' ] ?? 'http ' )->getScheme ();
372334
373335 if (isset ($ parts ['port ' ])) {
374336 // Valid port numbers are enforced by earlier parse_url or setPort()
0 commit comments