Conditions | 4 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function findAction($message) |
||
32 | { |
||
33 | $text = trim($message['text']); |
||
34 | |||
35 | if (false !== strpos($text, ' ')) { |
||
36 | return false; |
||
37 | } |
||
38 | |||
39 | $text = str_replace('/', '', $text); |
||
40 | $text = str_replace('@'.$this->botApi->getBotName(), '', $text); |
||
41 | $text = 'Chrl\AppBundle\GameAction\\'.ucfirst(strtolower($text)).'Action'; |
||
42 | |||
43 | if (class_exists($text, true)) { |
||
44 | |||
45 | /** @var BaseGameAction $gameAction */ |
||
46 | |||
47 | $gameAction = new $text($this->gameService, $this->botApi); |
||
48 | |||
49 | if ($gameAction instanceof GameActionInterface) { |
||
50 | return $gameAction; |
||
51 | } |
||
52 | } |
||
53 | return $text; |
||
54 | } |
||
55 | } |
||
56 |