@@ -468,6 +468,7 @@ public function controller($route, $settings, $controller = null)
468
468
}
469
469
470
470
$ controller = str_replace (['\\' , '. ' ], '/ ' , $ controller );
471
+ $ controller = trim (preg_replace ('/ ' .$ this ->paths ['controllers ' ].'/i ' , '' , $ controller , 1 ), '/ ' );
471
472
$ controllerFile = realpath (
472
473
rtrim ($ this ->paths ['controllers ' ], '/ ' ) . '/ ' . $ controller . '.php '
473
474
);
@@ -493,14 +494,15 @@ public function controller($route, $settings, $controller = null)
493
494
}
494
495
}
495
496
496
- $ methodVar = lcfirst (str_replace ($ method , '' , $ methodName ));
497
+ $ methodVar = lcfirst (preg_replace ('/ ' .$ method .'/i ' , '' , $ methodName , 1 ));
498
+ $ methodVar = strtolower (preg_replace ('%([a-z]|[0-9])([A-Z])% ' , '\1-\2 ' , $ methodVar ));
497
499
$ r = new ReflectionMethod ($ this ->namespaces ['controllers ' ] . $ controller , $ methodName );
498
500
$ reqiredParam = $ r ->getNumberOfRequiredParameters ();
499
501
$ totalParam = $ r ->getNumberOfParameters ();
500
502
501
503
$ value = ($ methodVar === $ this ->mainMethod ? $ route : $ route .'/ ' .$ methodVar );
502
504
$ this ->{$ method }(
503
- ($ value .str_repeat ('/{a} ' , $ reqiredParam ).str_repeat ('/{a?} ' , $ totalParam -$ reqiredParam )),
505
+ ($ value .str_repeat ('/:any ' , $ reqiredParam ).str_repeat ('/:any? ' , $ totalParam -$ reqiredParam )),
504
506
$ settings ,
505
507
($ controller . '@ ' . $ methodName )
506
508
);
0 commit comments