Skip to content

Commit e7e160a

Browse files
committed
Added files via upload
1 parent 6a0b7b1 commit e7e160a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Telegram.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ public function getCommandObject($command)
252252
$which[] = 'User';
253253

254254
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';
257256
if (class_exists($command_namespace)) {
258257
return new $command_namespace($this, $this->update);
259258
}
@@ -431,8 +430,7 @@ public function handle()
431430
*/
432431
private function getCommandFromType($type)
433432
{
434-
// return ucfirst(str_replace('_', '', $type));
435-
return $this->mb_ucfirst(str_replace('_', '', $type));
433+
return $this->ucfirstUnicode(str_replace('_', '', $type));
436434
}
437435

438436
/**
@@ -523,8 +521,7 @@ public function executeCommand($command)
523521
*/
524522
protected function sanitizeCommand($command)
525523
{
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)));
528525
}
529526

530527
/**
@@ -771,7 +768,8 @@ public function unsetWebHook()
771768
*
772769
* @return string
773770
*/
774-
protected function mb_ucwords($str, $encoding = 'UTF-8') {
771+
protected function ucwordsUnicode($str, $encoding = 'UTF-8')
772+
{
775773
return mb_convert_case($str, MB_CASE_TITLE, $encoding);
776774
}
777775

@@ -783,8 +781,8 @@ protected function mb_ucwords($str, $encoding = 'UTF-8') {
783781
*
784782
* @return string
785783
*/
786-
protected function mb_ucfirst($str, $encoding = 'UTF-8') {
784+
protected function ucfirstUnicode($str, $encoding = 'UTF-8')
785+
{
787786
return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding);
788787
}
789-
790788
}

0 commit comments

Comments
 (0)