@@ -67,8 +67,7 @@ |
||
| 67 | 67 | $sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8); |
| 68 | 68 | switch ($word{$i} === 's' ? 0 : mt_rand(0, 2)) |
| 69 | 69 | { |
| 70 | - case 0 : |
|
| 71 | - for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 70 | + case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 72 | 71 | for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
| 73 | 72 | $sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF))); |
| 74 | 73 | break; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | if ($c === $n) { |
| 147 | 147 | $q = $delta; |
| 148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
| 148 | + for ($k = static::BASE; ; $k += static::BASE) { |
|
| 149 | 149 | $t = $this->calculateThreshold($k, $bias); |
| 150 | 150 | if ($q < $t) { |
| 151 | 151 | break; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $oldi = $i; |
| 228 | 228 | $w = 1; |
| 229 | 229 | |
| 230 | - for ($k = static::BASE;; $k += static::BASE) |
|
| 230 | + for ($k = static::BASE; ; $k += static::BASE) |
|
| 231 | 231 | { |
| 232 | 232 | $digit = static::$decodeTable[$input[$pos++]]; |
| 233 | 233 | $i = $i + ($digit * $w); |
@@ -94,7 +94,8 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $input = mb_strtolower($input, $this->encoding); |
| 96 | 96 | $parts = explode('.', $input); |
| 97 | - foreach ($parts as &$part) { |
|
| 97 | + foreach ($parts as &$part) |
|
| 98 | + { |
|
| 98 | 99 | $part = $this->encodePart($part); |
| 99 | 100 | } |
| 100 | 101 | $output = implode('.', $parts); |
@@ -119,13 +120,16 @@ discard block |
||
| 119 | 120 | $h = $b = count($codePoints['basic']); |
| 120 | 121 | |
| 121 | 122 | $output = ''; |
| 122 | - foreach ($codePoints['basic'] as $code) { |
|
| 123 | + foreach ($codePoints['basic'] as $code) |
|
| 124 | + { |
|
| 123 | 125 | $output .= $this->codePointToChar($code); |
| 124 | 126 | } |
| 125 | - if ($input === $output) { |
|
| 127 | + if ($input === $output) |
|
| 128 | + { |
|
| 126 | 129 | return $output; |
| 127 | 130 | } |
| 128 | - if ($b > 0) { |
|
| 131 | + if ($b > 0) |
|
| 132 | + { |
|
| 129 | 133 | $output .= static::DELIMITER; |
| 130 | 134 | } |
| 131 | 135 | |
@@ -134,20 +138,26 @@ discard block |
||
| 134 | 138 | |
| 135 | 139 | $i = 0; |
| 136 | 140 | $length = mb_strlen($input, $this->encoding); |
| 137 | - while ($h < $length) { |
|
| 141 | + while ($h < $length) |
|
| 142 | + { |
|
| 138 | 143 | $m = $codePoints['nonBasic'][$i++]; |
| 139 | 144 | $delta = $delta + ($m - $n) * ($h + 1); |
| 140 | 145 | $n = $m; |
| 141 | 146 | |
| 142 | - foreach ($codePoints['all'] as $c) { |
|
| 143 | - if ($c < $n || $c < static::INITIAL_N) { |
|
| 147 | + foreach ($codePoints['all'] as $c) |
|
| 148 | + { |
|
| 149 | + if ($c < $n || $c < static::INITIAL_N) |
|
| 150 | + { |
|
| 144 | 151 | $delta++; |
| 145 | 152 | } |
| 146 | - if ($c === $n) { |
|
| 153 | + if ($c === $n) |
|
| 154 | + { |
|
| 147 | 155 | $q = $delta; |
| 148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
| 156 | + for ($k = static::BASE;; $k += static::BASE) |
|
| 157 | + { |
|
| 149 | 158 | $t = $this->calculateThreshold($k, $bias); |
| 150 | - if ($q < $t) { |
|
| 159 | + if ($q < $t) |
|
| 160 | + { |
|
| 151 | 161 | break; |
| 152 | 162 | } |
| 153 | 163 | |