| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 20 |
| Ratio | 100 % |
| Tests | 11 |
| CRAP Score | 2 |
| 1 | <?php |
||
| 39 | 6 | private function setEmoji($emoji) |
|
| 40 | { |
||
| 41 | // remove the whitespace |
||
| 42 | 6 | $emoji = trim($emoji); |
|
| 43 | |||
| 44 | 6 | $emojiValidationRegex = '_^:[\w-+]+:$_iuS'; |
|
| 45 | 6 | if (!preg_match($emojiValidationRegex, $emoji)) { |
|
| 46 | 1 | throw new InvalidEmojiException( |
|
| 47 | 1 | sprintf( |
|
| 48 | 'The emoji: "%s" is not a valid emoji. |
||
| 49 | 1 | An emoji should always be a string starting and ending with ":".', |
|
| 50 | $emoji |
||
| 51 | 1 | ), |
|
| 52 | 400 |
||
| 53 | 1 | ); |
|
| 54 | } |
||
| 55 | 5 | $this->emoji = $emoji; |
|
| 56 | |||
| 57 | 5 | return $this; |
|
| 58 | } |
||
| 59 | |||
| 84 |