| 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 |
||
| 32 | 17 | private function setName($name) |
|
| 33 | { |
||
| 34 | // names should be lowercase so we just enforce this without further validation |
||
| 35 | 17 | $name = trim(mb_strtolower($name, 'UTF8')); |
|
| 36 | |||
| 37 | 17 | if (!preg_match('_^[#@][\w-]{1,21}$_', $name)) { |
|
| 38 | 10 | throw new InvalidChannelException( |
|
| 39 | 'Channel names must be all lowercase. |
||
| 40 | The name should start with "#" for a channel or "@" for an account |
||
| 41 | 10 | They cannot be longer than 21 characters and can only contain letters, numbers, hyphens, and underscores.', |
|
| 42 | 400 |
||
| 43 | 10 | ); |
|
| 44 | } |
||
| 45 | |||
| 46 | 7 | $this->name = $name; |
|
| 47 | 7 | } |
|
| 48 | |||
| 65 |