@@ -252,8 +252,7 @@ public function getCommandObject($command)
252
252
$ which [] = 'User ' ;
253
253
254
254
foreach ($ which as $ auth ) {
255
- // $command_namespace = __NAMESPACE__ . '\\Commands\\' . $auth . 'Commands\\' . ucfirst($command) . 'Command';
256
- $ command_namespace = __NAMESPACE__ . '\\Commands \\' . $ auth . 'Commands \\' . $ this ->mb_ucfirst ($ command ) . 'Command ' ;
255
+ $ command_namespace = __NAMESPACE__ . '\\Commands \\' . $ auth . 'Commands \\' . $ this ->ucfirstUnicode ($ command ) . 'Command ' ;
257
256
if (class_exists ($ command_namespace )) {
258
257
return new $ command_namespace ($ this , $ this ->update );
259
258
}
@@ -431,8 +430,7 @@ public function handle()
431
430
*/
432
431
private function getCommandFromType ($ type )
433
432
{
434
- // return ucfirst(str_replace('_', '', $type));
435
- return $ this ->mb_ucfirst (str_replace ('_ ' , '' , $ type ));
433
+ return $ this ->ucfirstUnicode (str_replace ('_ ' , '' , $ type ));
436
434
}
437
435
438
436
/**
@@ -523,8 +521,7 @@ public function executeCommand($command)
523
521
*/
524
522
protected function sanitizeCommand ($ command )
525
523
{
526
- // return str_replace(' ', '', ucwords(str_replace('_', ' ', $command)));
527
- return str_replace (' ' , '' , $ this ->mb_ucwords (str_replace ('_ ' , ' ' , $ command )));
524
+ return str_replace (' ' , '' , $ this ->ucwordsUnicode (str_replace ('_ ' , ' ' , $ command )));
528
525
}
529
526
530
527
/**
@@ -771,7 +768,8 @@ public function unsetWebHook()
771
768
*
772
769
* @return string
773
770
*/
774
- protected function mb_ucwords ($ str , $ encoding = 'UTF-8 ' ) {
771
+ protected function ucwordsUnicode ($ str , $ encoding = 'UTF-8 ' )
772
+ {
775
773
return mb_convert_case ($ str , MB_CASE_TITLE , $ encoding );
776
774
}
777
775
@@ -783,8 +781,8 @@ protected function mb_ucwords($str, $encoding = 'UTF-8') {
783
781
*
784
782
* @return string
785
783
*/
786
- protected function mb_ucfirst ($ str , $ encoding = 'UTF-8 ' ) {
784
+ protected function ucfirstUnicode ($ str , $ encoding = 'UTF-8 ' )
785
+ {
787
786
return mb_strtoupper (mb_substr ($ str , 0 , 1 , $ encoding ), $ encoding ) . mb_strtolower (mb_substr ($ str , 1 , mb_strlen ($ str ), $ encoding ), $ encoding );
788
787
}
789
-
790
788
}
0 commit comments