GroupsController   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A registerNewGroup() 0 4 1
A registerNewChatMember() 0 10 4
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