@@ -162,7 +162,7 @@ private function searchFirstController(): bool
162162 $ segment = array_shift ($ segments );
163163 $ controllerPos ++;
164164
165- $ class = $ this ->translateURIDashes ($ segment );
165+ $ class = $ this ->translateURI ($ segment );
166166
167167 // as soon as we encounter any segment that is not PSR-4 compliant, stop searching
168168 if (! $ this ->isValidSegment ($ class )) {
@@ -209,7 +209,7 @@ private function searchLastDefaultController(): bool
209209 }
210210
211211 $ namespaces = array_map (
212- fn ($ segment ) => $ this ->translateURIDashes ($ segment ),
212+ fn ($ segment ) => $ this ->translateURI ($ segment ),
213213 $ segments
214214 );
215215
@@ -307,7 +307,7 @@ public function getRoute(string $uri, string $httpVerb): array
307307
308308 $ method = '' ;
309309 if ($ methodParam !== null ) {
310- $ method = $ httpVerb . $ this ->translateURIDashes ($ methodParam );
310+ $ method = $ httpVerb . $ this ->translateURI ($ methodParam );
311311
312312 $ this ->checkUriForMethod ($ method );
313313 }
@@ -544,7 +544,10 @@ private function isValidSegment(string $segment): bool
544544 return (bool ) preg_match ('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/ ' , $ segment );
545545 }
546546
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
548551 {
549552 if ($ this ->translateUriToCamelCase ) {
550553 if (strtolower ($ segment ) !== $ segment ) {
0 commit comments