@@ -591,13 +591,9 @@ discard block |
||
591 | 591 | |
592 | 592 | if ($length === 2) { |
593 | 593 | $bigcode = $byte & 0b00011111; |
594 | - } |
|
595 | - |
|
596 | - elseif ($length === 3) { |
|
594 | + } elseif ($length === 3) { |
|
597 | 595 | $bigcode = $byte & 0b00001111; |
598 | - } |
|
599 | - |
|
600 | - elseif ($length === 4) { |
|
596 | + } elseif ($length === 4) { |
|
601 | 597 | $bigcode = $byte & 0b00000111; |
602 | 598 | } |
603 | 599 | |
@@ -688,9 +684,15 @@ discard block |
||
688 | 684 | |
689 | 685 | protected static function calcUtf8CharLength($byte) |
690 | 686 | { |
691 | - if (~$byte & 0b00001000) return 4; |
|
692 | - if (~$byte & 0b00010000) return 3; |
|
693 | - if (~$byte & 0b00100000) return 2; |
|
687 | + if (~$byte & 0b00001000) { |
|
688 | + return 4; |
|
689 | + } |
|
690 | + if (~$byte & 0b00010000) { |
|
691 | + return 3; |
|
692 | + } |
|
693 | + if (~$byte & 0b00100000) { |
|
694 | + return 2; |
|
695 | + } |
|
694 | 696 | return 1; |
695 | 697 | } |
696 | 698 | } |