@@ -162,7 +162,7 @@ private function searchFirstController(): bool
162
162
$ segment = array_shift ($ segments );
163
163
$ controllerPos ++;
164
164
165
- $ class = $ this ->translateURIDashes ($ segment );
165
+ $ class = $ this ->translateURI ($ segment );
166
166
167
167
// as soon as we encounter any segment that is not PSR-4 compliant, stop searching
168
168
if (! $ this ->isValidSegment ($ class )) {
@@ -209,7 +209,7 @@ private function searchLastDefaultController(): bool
209
209
}
210
210
211
211
$ namespaces = array_map (
212
- fn ($ segment ) => $ this ->translateURIDashes ($ segment ),
212
+ fn ($ segment ) => $ this ->translateURI ($ segment ),
213
213
$ segments
214
214
);
215
215
@@ -307,7 +307,7 @@ public function getRoute(string $uri, string $httpVerb): array
307
307
308
308
$ method = '' ;
309
309
if ($ methodParam !== null ) {
310
- $ method = $ httpVerb . $ this ->translateURIDashes ($ methodParam );
310
+ $ method = $ httpVerb . $ this ->translateURI ($ methodParam );
311
311
312
312
$ this ->checkUriForMethod ($ method );
313
313
}
@@ -544,7 +544,10 @@ private function isValidSegment(string $segment): bool
544
544
return (bool ) preg_match ('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/ ' , $ segment );
545
545
}
546
546
547
- private function translateURIDashes (string $ segment ): string
547
+ /**
548
+ * Translates URI segment to CamelCase or replaces `-` with `_`.
549
+ */
550
+ private function translateURI (string $ segment ): string
548
551
{
549
552
if ($ this ->translateUriToCamelCase ) {
550
553
if (strtolower ($ segment ) !== $ segment ) {
0 commit comments