| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 28 | 30 | public static function computeErasingLength(?string $in): int |
|
| 29 | { |
||
| 30 | 30 | if (null === $in || Defaults::EMPTY_STRING === $in) { |
|
| 31 | 2 | return 0; |
|
| 32 | } |
||
| 33 | 28 | $in = Strip::escCodes($in); |
|
| 34 | 28 | $mbSymbolLen = mb_strlen($in); |
|
| 35 | 28 | $oneCharLen = strlen($in) / $mbSymbolLen; |
|
| 36 | 28 | if (4 === $oneCharLen) { |
|
| 37 | 3 | return 2 * $mbSymbolLen; |
|
| 38 | } |
||
| 39 | 28 | return mb_strwidth($in); |
|
| 40 | } |
||
| 42 |