Passed
Push — master ( 06b70e...4674d4 )
by Jeroen
01:32
created

IrcChannel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 10
dl 0
loc 55
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUsers() 0 3 1
A __construct() 0 4 1
A getUsers() 0 3 1
A setTopic() 0 3 1
A getTopic() 0 3 1
1
<?php
2
3
namespace Jerodev\PhpIrcClient;
4
5
class IrcChannel
6
{
7
    /** @var string */
8
    private $name;
9
10
    /** @var null|string */
11
    private $topic;
12
13
    /** @var string[] */
14
    private $users;
15
16
    public function __construct(string $name)
17
    {
18
        $this->name = $name;
19
        $this->users = [];
20
    }
21
22
    /**
23
     *  Get the current channel topic.
24
     *
25
     *  @return null|string
26
     */
27
    public function getTopic()
28
    {
29
        return $this->topic;
30
    }
31
32
    /**
33
     *  Fetch the list of users currently on this channel.
34
     *
35
     *  @return string[]
36
     */
37
    public function getUsers(): array
38
    {
39
        return $this->users;
40
    }
41
42
    /**
43
     *  Set the current channel topic.
44
     *
45
     *  @param string $topic The topic
46
     */
47
    public function setTopic(string $topic): void
48
    {
49
        $this->topic = $topic;
50
    }
51
52
    /**
53
     *  Set the list of active users on the channel.
54
     *
55
     *  @param string[] $users An array of user names.
56
     */
57
    public function setUsers(array $users): void
58
    {
59
        $this->users = $users;
60
    }
61
}
62