Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 69 | protected function generalRulesCheck(string $topic): bool |
|
16 | { |
||
17 | 69 | if ($topic === '') { |
|
18 | 1 | throw (new \InvalidArgumentException('Topics must be at least 1 character long')); |
|
19 | } |
||
20 | |||
21 | // UTF-8 topic names and filters must not be more than 65535 bytes in size |
||
22 | 68 | if (\strlen($topic) > 65535) { |
|
23 | 1 | throw (new \OutOfBoundsException('Topics can not exceed 65535 bytes in size')); |
|
24 | } |
||
25 | |||
26 | 67 | if (strpos($topic, \chr(0)) !== false) { |
|
27 | 1 | throw (new \InvalidArgumentException('Topics can not contain the termination character')); |
|
28 | } |
||
29 | |||
30 | 66 | return true; |
|
31 | } |
||
33 |