Total Complexity | 3 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 1 | abstract class BaseChatCommand implements IChatCommand |
|
13 | { |
||
14 | use \Nette\SmartObject; |
||
15 | |||
16 | protected string $name = ""; |
||
17 | |||
18 | /** |
||
19 | * Defines default name for the chat command |
||
20 | * The class' name has to follow XCommand pattern |
||
21 | */ |
||
22 | public function getName(): string |
||
23 | { |
||
24 | 1 | if ($this->name !== "") { |
|
25 | 1 | return $this->name; |
|
26 | } |
||
27 | 1 | $className = join('', array_slice(explode('\\', static::class), -1)); |
|
28 | 1 | return strtolower(str_replace("Command", "", $className)); |
|
29 | } |
||
30 | |||
31 | public function setName(string $name): void |
||
34 | 1 | } |
|
35 | } |
||
36 |