Completed
Push — master ( a7adc8...500d1e )
by dan
02:35
created

User::setUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test\Entity;
4
5
use IrishDan\NotificationBundle\DatabaseNotifiableInterface;
6
use IrishDan\NotificationBundle\EmailableInterface;
7
use IrishDan\NotificationBundle\Notification\NotifiableInterface;
8
use IrishDan\NotificationBundle\PusherableInterface;
9
use IrishDan\NotificationBundle\SlackableInterface;
10
use IrishDan\NotificationBundle\TextableInterface;
11
12
class User implements NotifiableInterface, EmailableInterface, TextableInterface, PusherableInterface, SlackableInterface, DatabaseNotifiableInterface
13
{
14
    private $id = 1;
15
    private $username = 'jimBob';
16
    private $email = '[email protected]';
17
    private $subscribedChannels = [
18
        'database',
19
        'mail',
20
        'pusher',
21
        'nexmo',
22
        'slack',
23
    ];
24
25
    public function getNumber()
26
    {
27
        return '+44755667788';
28
    }
29
30
    public function getId()
31
    {
32
        return $this->id;
33
    }
34
35
    public function getUsername()
36
    {
37
        return $this->username;
38
    }
39
40
    public function setUsername($username)
41
    {
42
        $this->username = $username;
43
    }
44
45
    public function getEmail()
46
    {
47
        return $this->email;
48
    }
49
50
    public function setEmail($email)
51
    {
52
        $this->email = $email;
53
    }
54
55
    public function isSubscribedToChannel($channel)
56
    {
57
        $subscribedChannels = $this->getSubscribedChannels();
58
59
        return in_array($channel, $subscribedChannels);
60
    }
61
62
    public function getSubscribedChannels()
63
    {
64
        return $this->subscribedChannels;
65
    }
66
67
    public function getPusherChannelSuffix()
68
    {
69
        return $this->id;
70
    }
71
72
    public function getSlackWebhook()
73
    {
74
        return 'https://hooks.slack.com/services/salty/salt/1234567890';
75
    }
76
77
    public function getIdentifier()
78
    {
79
        return $this->getId();
80
    }
81
82
    public function setSubscribedChannels(array $channels)
83
    {
84
        return $this->subscribedChannels = $channels;
85
    }
86
}
87