Passed
Pull Request — develop (#1493)
by Rabie
06:35
created

GenericmessageCommand::execute()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 3
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 9
rs 10
ccs 0
cts 4
cp 0
crap 12
1
<?php
2
3
/**
4
 * This file is part of the TelegramBot package.
5
 *
6
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Longman\TelegramBot\Commands\SystemCommands;
13
14
use Longman\TelegramBot\Commands\SystemCommand;
15
use Longman\TelegramBot\Entities\ServerResponse;
16
use Longman\TelegramBot\Exception\TelegramException;
17
use Longman\TelegramBot\Request;
18
use Longman\TelegramBot\Telegram;
19
20
/**
21
 * Generic message command
22
 */
23
class GenericmessageCommand extends SystemCommand
24
{
25
    /**
26
     * @var string
27
     */
28
    protected $name = Telegram::GENERIC_MESSAGE_COMMAND;
29
30
    /**
31
     * @var string
32
     */
33
    protected $description = 'Handle generic message';
34
35
    /**
36
     * @var string
37
     */
38
    protected $version = '1.2.1'; // Updated version
39
40
    /**
41
     * @var bool
42
     */
43
    protected $need_mysql = false; // MySQL is no longer used
44
45
    /**
46
     * Execute command
47
     *
48
     * @return ServerResponse
49
     * @throws TelegramException
50
     */
51
    public function execute(): ServerResponse
52
    {
53
        // Conversation logic removed.
54
        // Try to execute any deprecated system commands.
55
        if (self::$execute_deprecated && $deprecated_system_command_response = $this->executeDeprecatedSystemCommand()) {
56
            return $deprecated_system_command_response;
57
        }
58
59
        return Request::emptyResponse();
60
    }
61
}
62