Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.5923 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
9786 | 4 | public static function strncmp( |
|
9787 | string $str1, |
||
9788 | string $str2, |
||
9789 | int $len, |
||
9790 | string $encoding = 'UTF-8' |
||
9791 | ): int { |
||
9792 | 4 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
|
9793 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
||
9794 | } |
||
9795 | |||
9796 | 4 | if ($encoding === 'UTF-8') { |
|
9797 | 4 | $str1 = (string) \mb_substr($str1, 0, $len); |
|
9798 | 4 | $str2 = (string) \mb_substr($str2, 0, $len); |
|
9799 | } else { |
||
9800 | $str1 = (string) self::substr($str1, 0, $len, $encoding); |
||
9801 | $str2 = (string) self::substr($str2, 0, $len, $encoding); |
||
9802 | } |
||
9803 | |||
9804 | 4 | return self::strcmp($str1, $str2); |
|
9805 | } |
||
13694 |