| @@ 156-160 (lines=5) @@ | ||
| 153 | $remaining = 0; |
|
| 154 | } |
|
| 155 | // Two byte sequence: |
|
| 156 | elseif (($value & 0xE0) === 0xC0) { |
|
| 157 | $character = ($value & 0x1F) << 6; |
|
| 158 | $length = 2; |
|
| 159 | $remaining = 1; |
|
| 160 | } |
|
| 161 | // Three byte sequence: |
|
| 162 | elseif (($value & 0xF0) === 0xE0) { |
|
| 163 | $character = ($value & 0x0F) << 12; |
|
| @@ 162-166 (lines=5) @@ | ||
| 159 | $remaining = 1; |
|
| 160 | } |
|
| 161 | // Three byte sequence: |
|
| 162 | elseif (($value & 0xF0) === 0xE0) { |
|
| 163 | $character = ($value & 0x0F) << 12; |
|
| 164 | $length = 3; |
|
| 165 | $remaining = 2; |
|
| 166 | } |
|
| 167 | // Four byte sequence: |
|
| 168 | elseif (($value & 0xF8) === 0xF0) { |
|
| 169 | $character = ($value & 0x07) << 18; |
|
| @@ 168-172 (lines=5) @@ | ||
| 165 | $remaining = 2; |
|
| 166 | } |
|
| 167 | // Four byte sequence: |
|
| 168 | elseif (($value & 0xF8) === 0xF0) { |
|
| 169 | $character = ($value & 0x07) << 18; |
|
| 170 | $length = 4; |
|
| 171 | $remaining = 3; |
|
| 172 | } |
|
| 173 | // Invalid byte: |
|
| 174 | else { |
|
| 175 | throw new Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $value); |
|
| @@ 455-459 (lines=5) @@ | ||
| 452 | $remaining = 1; |
|
| 453 | } |
|
| 454 | // Three byte sequence: |
|
| 455 | elseif (($value & 0xF0) === 0xE0) { |
|
| 456 | $character = ($value & 0x0F) << 12; |
|
| 457 | $length = 3; |
|
| 458 | $remaining = 2; |
|
| 459 | } |
|
| 460 | // Four byte sequence: |
|
| 461 | elseif (($value & 0xF8) === 0xF0) { |
|
| 462 | $character = ($value & 0x07) << 18; |
|
| @@ 461-465 (lines=5) @@ | ||
| 458 | $remaining = 2; |
|
| 459 | } |
|
| 460 | // Four byte sequence: |
|
| 461 | elseif (($value & 0xF8) === 0xF0) { |
|
| 462 | $character = ($value & 0x07) << 18; |
|
| 463 | $length = 4; |
|
| 464 | $remaining = 3; |
|
| 465 | } |
|
| 466 | // Invalid byte: |
|
| 467 | else { |
|
| 468 | $valid = false; |
|
| @@ 576-580 (lines=5) @@ | ||
| 573 | $length = 1; |
|
| 574 | } |
|
| 575 | // Two byte sequence: |
|
| 576 | elseif (($value & 0xE0) === 0xC0) { |
|
| 577 | $character = ($value & 0x1F) << 6; |
|
| 578 | $length = 2; |
|
| 579 | $remaining = 1; |
|
| 580 | } |
|
| 581 | // Three byte sequence: |
|
| 582 | elseif (($value & 0xF0) === 0xE0) { |
|
| 583 | $character = ($value & 0x0F) << 12; |
|
| @@ 582-586 (lines=5) @@ | ||
| 579 | $remaining = 1; |
|
| 580 | } |
|
| 581 | // Three byte sequence: |
|
| 582 | elseif (($value & 0xF0) === 0xE0) { |
|
| 583 | $character = ($value & 0x0F) << 12; |
|
| 584 | $length = 3; |
|
| 585 | $remaining = 2; |
|
| 586 | } |
|
| 587 | // Four byte sequence: |
|
| 588 | elseif (($value & 0xF8) === 0xF0) { |
|
| 589 | $character = ($value & 0x07) << 18; |
|
| @@ 588-592 (lines=5) @@ | ||
| 585 | $remaining = 2; |
|
| 586 | } |
|
| 587 | // Four byte sequence: |
|
| 588 | elseif (($value & 0xF8) === 0xF0) { |
|
| 589 | $character = ($value & 0x07) << 18; |
|
| 590 | $length = 4; |
|
| 591 | $remaining = 3; |
|
| 592 | } |
|
| 593 | // Invalid byte: |
|
| 594 | else { |
|
| 595 | $valid = false; |
|