| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 26 | 2 | public function length() : int |
|
| 27 | { |
||
| 28 | 2 | $length = mb_strlen($this->value); |
|
| 29 | |||
| 30 | 2 | if (!$this->isGsm7()) { |
|
| 31 | 2 | return $length; |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | $doubles = GSM7::DOUBLES; |
|
| 35 | |||
| 36 | 2 | for ($i = 0; $i < $length; $i++) { |
|
| 37 | 2 | $char = mb_substr($this->value, $i, 1); |
|
| 38 | 2 | if (in_array($char, $doubles)) { |
|
| 39 | 1 | $length++; |
|
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | 2 | return $length; |
|
| 44 | } |
||
| 45 | |||
| 55 |