Total Complexity | 5 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 |
||
60 | } |
||
61 | } |
||
62 |