Conditions | 4 |
Paths | 3 |
Total Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
44 | public function setText($text) |
||
45 | { |
||
46 | 1 | if (!is_string($text)) |
|
47 | 1 | throw new InvalidArgumentException('Parameter "text" must be type of string, it\'s ' . gettype($text) . '.'); |
|
48 | 1 | if (strlen($text) < 1 OR strlen($text) > 160) |
|
49 | 1 | throw new InvalidArgumentException('Parameter "text" must be length 1-160 characters. Has ' . strlen($text) . ' characters.'); |
|
50 | 1 | return parent::setText(Strings::toAscii($text)); |
|
51 | } |
||
52 | } |
||
53 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.