Passed
Push — master ( f1ae62...d4b34d )
by herry
11:49
created
src/Pinyin.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             list($option, $delimiter) = [$delimiter, ''];
145 145
         }
146 146
 
147
-        return implode($delimiter, array_map(function ($pinyin) {
147
+        return implode($delimiter, array_map(function($pinyin) {
148 148
             return is_numeric($pinyin) ? $pinyin : mb_substr($pinyin, 0, 1);
149 149
         }, $this->convert($string, $option)));
150 150
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function setDataPath(?string $path): self
229 229
     {
230
-        $path = $path ?? dirname(__DIR__) . '/data/';
230
+        $path = $path ?? dirname(__DIR__).'/data/';
231 231
         if (!is_dir($path)) {
232 232
             throw new InvalidArgumentException(sprintf('\'%s\' is not valid data path.', $path));
233 233
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             $string = $this->convertSurname($string, $dictLoader);
253 253
         }
254 254
 
255
-        $dictLoader->map(function ($dictionary) use (&$string) {
255
+        $dictLoader->map(function($dictionary) use (&$string) {
256 256
             $string = strtr($string, $dictionary);
257 257
         });
258 258
 
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
      */
270 270
     protected function convertSurname(string $string, DictLoader $dictLoader): string
271 271
     {
272
-        $dictLoader->mapSurname(function ($dictionary) use (&$string) {
272
+        $dictLoader->mapSurname(function($dictionary) use (&$string) {
273 273
             foreach ($dictionary as $surname => $pinyin) {
274 274
                 if (0 === strpos($string, $surname)) {
275
-                    $string = $pinyin . mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
275
+                    $string = $pinyin.mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
276 276
 
277 277
                     break;
278 278
                 }
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
      */
325 325
     protected function prepare(string $string, int $option = self::DEFAULT): string
326 326
     {
327
-        $string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) {
328
-            return "\t" . $matches[0];
327
+        $string = preg_replace_callback('~[a-z0-9_-]+~i', function($matches) {
328
+            return "\t".$matches[0];
329 329
         }, $string);
330 330
 
331 331
         $regex = ['\p{Han}', '\p{Z}', '\p{M}', "\t"];
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                     $umlaut = 'v';
375 375
                 }
376 376
 
377
-                $pinyin = str_replace($unicode, $umlaut, $pinyin) . ($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
377
+                $pinyin = str_replace($unicode, $umlaut, $pinyin).($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
378 378
             }
379 379
         }
380 380
 
Please login to merge, or discard this patch.
src/Loaders/File.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function map(Closure $callback)
50 50
     {
51
-        $segments = glob($this->path . '/' . $this->segmentName);
51
+        $segments = glob($this->path.'/'.$this->segmentName);
52 52
         while (($segment = array_shift($segments))) {
53
-            $dictionary = (array)include $segment;
53
+            $dictionary = (array) include $segment;
54 54
             $callback($dictionary);
55 55
         }
56 56
     }
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function mapSurname(Closure $callback)
64 64
     {
65
-        $surnames = $this->path . '/surnames';
65
+        $surnames = $this->path.'/surnames';
66 66
 
67 67
         if (file_exists($surnames)) {
68
-            $dictionary = (array)include $surnames;
68
+            $dictionary = (array) include $surnames;
69 69
             $callback($dictionary);
70 70
         }
71 71
     }
Please login to merge, or discard this patch.
src/Loaders/GeneratorFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
      */
48 48
     public function __construct($path)
49 49
     {
50
-        $segments = glob($path . '/' . $this->segmentName);
50
+        $segments = glob($path.'/'.$this->segmentName);
51 51
         while (($segment = array_shift($segments))) {
52 52
             array_push(static::$handles, $this->openFile($segment));
53 53
         }
54
-        static::$surnamesHandle = $this->openFile($path . '/surnames');
54
+        static::$surnamesHandle = $this->openFile($path.'/surnames');
55 55
     }
56 56
 
57 57
     /**
Please login to merge, or discard this patch.
src/Loaders/MemoryFile.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@
 block discarded – undo
46 46
      */
47 47
     public function __construct($path)
48 48
     {
49
-        $segments = glob($path . '/' . $this->segmentName);
49
+        $segments = glob($path.'/'.$this->segmentName);
50 50
         while (($segment = array_shift($segments))) {
51
-            $this->segments[] = (array)include $segment;
51
+            $this->segments[] = (array) include $segment;
52 52
         }
53
-        $surnames = $path . '/surnames';
53
+        $surnames = $path.'/surnames';
54 54
         if (file_exists($surnames)) {
55
-            $this->surnames = (array)include $surnames;
55
+            $this->surnames = (array) include $surnames;
56 56
         }
57 57
     }
58 58
 
Please login to merge, or discard this patch.