Passed
Push — master ( d05c70...4f1d1d )
by herry
06:10
created
src/Pinyin.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             list($option, $delimiter) = [$delimiter, ''];
155 155
         }
156 156
 
157
-        return implode($delimiter, array_map(function ($pinyin) {
157
+        return implode($delimiter, array_map(function($pinyin) {
158 158
             return is_numeric($pinyin) ? $pinyin : mb_substr($pinyin, 0, 1);
159 159
         }, $this->convert($string, $option)));
160 160
     }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function setPath(?string $path): self
260 260
     {
261
-        $path = $path ?? dirname(__DIR__) . '/data/';
261
+        $path = $path ?? dirname(__DIR__).'/data/';
262 262
         if (!is_dir($path)) {
263 263
             throw new InvalidArgumentException(sprintf('\'%s\' is not valid data path.', $path));
264 264
         }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             $string = $this->convertSurname($string, $dictLoader);
285 285
         }
286 286
 
287
-        $dictLoader->map(function ($dictionary) use (&$string) {
287
+        $dictLoader->map(function($dictionary) use (&$string) {
288 288
             $string = strtr($string, $dictionary);
289 289
         });
290 290
 
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
      */
302 302
     protected function convertSurname(string $string, DictLoader $dictLoader): string
303 303
     {
304
-        $dictLoader->mapSurname(function ($dictionary) use (&$string) {
304
+        $dictLoader->mapSurname(function($dictionary) use (&$string) {
305 305
             foreach ($dictionary as $surname => $pinyin) {
306 306
                 if (0 === strpos($string, $surname)) {
307
-                    $string = $pinyin . mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
307
+                    $string = $pinyin.mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
308 308
 
309 309
                     break;
310 310
                 }
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
      */
361 361
     protected function prepare(string $string, int $option = self::DEFAULT): string
362 362
     {
363
-        $string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) {
364
-            return "\t" . $matches[0];
363
+        $string = preg_replace_callback('~[a-z0-9_-]+~i', function($matches) {
364
+            return "\t".$matches[0];
365 365
         }, $string);
366 366
 
367 367
         $regex = ['\p{Han}', '\p{Z}', '\p{M}', "\t"];
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                     $umlaut = 'v';
411 411
                 }
412 412
 
413
-                $pinyin = str_replace($unicode, $umlaut, $pinyin) . ($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
413
+                $pinyin = str_replace($unicode, $umlaut, $pinyin).($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
414 414
             }
415 415
         }
416 416
 
Please login to merge, or discard this patch.