Passed
Pull Request — develop (#1492)
by Rabie
07:07
created

ChatsCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
ccs 0
cts 2
cp 0
crap 2
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\AdminCommands;
13
14
use Longman\TelegramBot\Commands\AdminCommand;
15
use Longman\TelegramBot\DB;
0 ignored issues
show
Bug introduced by
The type Longman\TelegramBot\DB was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Longman\TelegramBot\Entities\ServerResponse;
17
use Longman\TelegramBot\Exception\TelegramException;
18
use Longman\TelegramBot\Request;
19
20
class ChatsCommand extends AdminCommand
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $name = 'chats';
26
27
    /**
28
     * @var string
29
     */
30
    protected $description = 'List or search all chats stored by the bot';
31
32
    /**
33
     * @var string
34
     */
35
    protected $usage = '/chats, /chats * or /chats <search string>';
36
37
    /**
38
     * @var string
39
     */
40
    protected $version = '1.2.0';
41
42
    /**
43
     * @var bool
44
     */
45
    protected $need_mysql = true;
46
47
    /**
48
     * Command execute method
49
     *
50
     * @return ServerResponse
51
     * @throws TelegramException
52
     */
53
    public function execute(): ServerResponse
54
    {
55
        $usage = $this->getUsage();
56
57
        return $this->replyToChat(sprintf('This command is not available because the database feature has been removed.%sUsage: %s', PHP_EOL, $usage));
58
    }
59
}
60