Completed
Pull Request — master (#14)
by Mischa ter
03:18
created
src/DamerauLevenshtein.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     ) {
101 101
         if (!empty($firstString) || !empty($secondString)) {
102 102
             $this->compOne = $firstString;
103
-            $this->compOneLength = (int)mb_strlen($this->compOne, 'UTF-8');
103
+            $this->compOneLength = (int) mb_strlen($this->compOne, 'UTF-8');
104 104
             $this->compTwo = $secondString;
105
-            $this->compTwoLength = (int)mb_strlen($this->compTwo, 'UTF-8');
105
+            $this->compTwoLength = (int) mb_strlen($this->compTwo, 'UTF-8');
106 106
         }
107 107
 
108 108
         $this->insCost = $insCost;
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 
165 165
         for ($i = 1; $i <= $oneSize; $i += 1) {
166 166
             // Curchar for the first string
167
-            $cOne = (string)mb_substr($this->compOne, $i - 1, 1, 'UTF-8');
167
+            $cOne = (string) mb_substr($this->compOne, $i - 1, 1, 'UTF-8');
168 168
             for ($j = 1; $j <= $twoSize; $j += 1) {
169 169
                 // Curchar for the second string
170
-                $cTwo = (string)mb_substr($this->compTwo, $j - 1, 1, 'UTF-8');
170
+                $cTwo = (string) mb_substr($this->compTwo, $j - 1, 1, 'UTF-8');
171 171
 
172 172
                 // Compute substitution cost
173 173
                 if ($this->compare($cOne, $cTwo) === 0) {
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
                 if ($i > 1 && $j > 1) {
197 197
                     // Last two
198 198
                     // @phan-suppress-next-line PhanPartialTypeMismatchArgumentInternal
199
-                    $ccOne = (string)mb_substr($this->compOne, $i - 2, 1, 'UTF-8');
199
+                    $ccOne = (string) mb_substr($this->compOne, $i - 2, 1, 'UTF-8');
200 200
                     // @phan-suppress-next-line PhanPartialTypeMismatchArgumentInternal
201
-                    $ccTwo = (string)mb_substr($this->compTwo, $j - 2, 1, 'UTF-8');
201
+                    $ccTwo = (string) mb_substr($this->compTwo, $j - 2, 1, 'UTF-8');
202 202
 
203 203
                     if ($this->compare($cOne, $ccTwo) === 0 && $this->compare($ccOne, $cTwo) === 0) {
204 204
                         // Transposition cost is computed as minimal of two
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $maxCost += $extraSize * $this->insCost;
245 245
         }
246 246
 
247
-        return (int)$maxCost;
247
+        return (int) $maxCost;
248 248
     }
249 249
 
250 250
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             $this->setupMatrix();
259 259
         }
260 260
 
261
-        return (float)(1 - ($this->getSimilarity() / $this->getMaximalDistance()));
261
+        return (float) (1 - ($this->getSimilarity() / $this->getMaximalDistance()));
262 262
     }
263 263
 
264 264
     /**
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
         $oneSize = $this->compOneLength;
288 288
         $twoSize = $this->compTwoLength;
289 289
 
290
-        $out = '  ' . $this->compOne . PHP_EOL;
290
+        $out = '  '.$this->compOne.PHP_EOL;
291 291
         for ($y = 0; $y <= $twoSize; $y += 1) {
292 292
             if ($y - 1 < 0) {
293 293
                 $out .= ' ';
294 294
             } else {
295
-                $out .= (string)mb_substr($this->compTwo, $y - 1, 1, 'UTF-8');
295
+                $out .= (string) mb_substr($this->compTwo, $y - 1, 1, 'UTF-8');
296 296
             }
297 297
 
298 298
             for ($x = 0; $x <= $oneSize; $x += 1) {
Please login to merge, or discard this patch.