| Conditions | 4 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 29 | public function ensureValidName($name) |
|
| 19 | { |
||
| 20 | if (!( |
||
| 21 | 29 | is_string($name) && |
|
| 22 | 29 | strlen($name) <= 200 && |
|
| 23 | 25 | preg_match(self::VALID_NAME_REGEX, $name) |
|
| 24 | 29 | )) { |
|
| 25 | 8 | throw new InvalidNameException(sprintf( |
|
| 26 | 8 | 'Invalid name: \'%s\'', $this->asString($name) |
|
| 27 | 8 | )); |
|
| 28 | } |
||
| 29 | |||
| 30 | 21 | return true; |
|
| 31 | } |
||
| 32 | |||
| 44 |