SlackTrait   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setSlack() 0 4 1
A getSlack() 0 4 1
A say() 0 4 1
A getUserById() 0 4 1
A getChannelById() 0 4 1
A getAuthedUser() 0 4 1
1
<?php
2
3
namespace Nopolabs\Yabot\Helpers;
4
5
use Nopolabs\Yabot\Slack\Client;
6
7
trait SlackTrait
8
{
9
    /** @var Client */
10
    private $slack;
11
12
    public function setSlack(Client $slack)
13
    {
14
        $this->slack = $slack;
15
    }
16
17
    public function getSlack() : Client
18
    {
19
        return $this->slack;
20
    }
21
22
    public function say($text, $channel, array $additionalParameters = [])
23
    {
24
        $this->getSlack()->say($text, $channel, $additionalParameters);
25
    }
26
27
    public function getUserById($userId)
28
    {
29
        return $this->getSlack()->getUserById($userId);
30
    }
31
32
    public function getChannelById($channelId)
33
    {
34
        return $this->getSlack()->getChannelById($channelId);
35
    }
36
37
    public function getAuthedUser()
38
    {
39
        return $this->getSlack()->getAuthedUser();
40
    }
41
}