Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 5 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
33 | 22 | private function setName($name) |
|
34 | { |
||
35 | // names should be lowercase so we just enforce this without further validation |
||
36 | 22 | $name = trim(mb_strtolower($name, 'UTF8')); |
|
37 | |||
38 | 22 | if (!preg_match('_^[#@][\w-]{1,21}$_', $name)) { |
|
39 | 10 | throw new InvalidChannelException( |
|
40 | 'Channel names must be all lowercase. |
||
41 | The name should start with "#" for a channel or "@" for an account |
||
42 | 10 | They cannot be longer than 21 characters and can only contain letters, numbers, hyphens, and underscores.', |
|
43 | 400 |
||
44 | 10 | ); |
|
45 | } |
||
46 | |||
47 | 12 | $this->name = $name; |
|
48 | 12 | } |
|
49 | |||
66 |