File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ public function match(Nette\Http\IRequest $httpRequest): ?array
176176
177177 } elseif ($ this ->type === self ::Relative) {
178178 $ basePath = $ url ->getBasePath ();
179- if (strncmp ($ url ->getPath (), $ basePath, strlen ( $ basePath )) !== 0 ) {
179+ if (! str_starts_with ($ url ->getPath (), $ basePath) ) {
180180 return null ;
181181 }
182182
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ protected function prepareRequest(Nette\Http\IRequest $httpRequest): ?Nette\Http
6868 if ($ this ->path ) {
6969 $ url = $ httpRequest ->getUrl ();
7070 $ relativePath = $ url ->getRelativePath ();
71- if (strncmp ($ relativePath , $ this ->path , strlen ( $ this -> path )) === 0 ) {
71+ if (str_starts_with ($ relativePath , $ this ->path ) ) {
7272 $ url = $ url ->withPath ($ url ->getPath (), $ url ->getBasePath () . $ this ->path );
7373 } elseif ($ relativePath . '/ ' === $ this ->path ) {
7474 $ url = $ url ->withPath ($ url ->getPath () . '/ ' );
@@ -148,7 +148,7 @@ public function warmupCache(): void
148148 ? $ router ->getConstantParameters ()
149149 : [];
150150
151- foreach (array_filter ($ params , ' is_scalar ' ) as $ name => $ value ) {
151+ foreach (array_filter ($ params , is_scalar (...) ) as $ name => $ value ) {
152152 $ candidates [$ name ][$ value ] = true ;
153153 }
154154
Original file line number Diff line number Diff line change 1818 */
1919class SimpleRouter implements Router
2020{
21- private array $ defaults ;
22-
23-
24- public function __construct (array $ defaults = [])
25- {
26- $ this ->defaults = $ defaults ;
21+ public function __construct (
22+ private readonly array $ defaults = [],
23+ ) {
2724 }
2825
2926
You can’t perform that action at this time.
0 commit comments