StartCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Commands\SystemCommands;
12
13
use Longman\TelegramBot\Commands\SystemCommand;
14
use Longman\TelegramBot\Request;
15
16
/**
17
 * Start command
18
 */
19
class StartCommand extends SystemCommand
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $name = 'start';
25
26
    /**
27
     * @var string
28
     */
29
    protected $description = 'Start command';
30
31
    /**
32
     * @var string
33
     */
34
    protected $usage = '/start';
35
36
    /**
37
     * @var string
38
     */
39
    protected $version = '1.1.0';
40
41
    /**
42
     * Command execute method
43
     *
44
     * @return mixed
45
     * @throws \Longman\TelegramBot\Exception\TelegramException
46
     */
47 View Code Duplication
    public function execute()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        $message = $this->getMessage();
50
51
        $chat_id = $message->getChat()->getId();
52
        $text    = 'Hi there!' . PHP_EOL . 'Type /help to see all commands!';
53
54
        $data = [
55
            'chat_id' => $chat_id,
56
            'text'    => $text,
57
        ];
58
59
        return Request::sendMessage($data);
60
    }
61
}
62