GroupsController::registerNewGroup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Transmissor\Http\Controllers;
4
5
use Transmissor\Conversations\RegisterGroupConversation;
6
use BotMan\BotMan\BotMan;
7
8
class GroupsController extends Controller
9
{
10
    public function register(BotMan $bot)
11
    {
12
        $bot->startConversation(new RegisterGroupConversation());
13
    }
14
15
    public function registerNewGroup($payload, BotMan $bot)
0 ignored issues
show
Unused Code introduced by
The parameter $payload is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        $this->register($bot);
18
    }
19
20
    public function registerNewChatMember($payload, BotMan $bot)
21
    {
22
        foreach ($payload as $newUser) {
23
            if ($newUser['is_bot'] && $newUser['id'] === config('botman.telegram.bot.id')) {
24
                $this->register($bot);
25
26
                return;
27
            }
28
        }
29
    }
30
}
31