Test Setup Failed
Push — master ( 4d0542...8630f9 )
by herry
31:19 queued 01:21
created
src/Pinyin.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             list($option, $delimiter) = [$delimiter, ''];
146 146
         }
147 147
 
148
-        return implode($delimiter, array_map(function ($pinyin) {
148
+        return implode($delimiter, array_map(function($pinyin) {
149 149
             return is_numeric($pinyin) ? $pinyin : mb_substr($pinyin, 0, 1);
150 150
         }, $this->convert($string, $option)));
151 151
     }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 $this->loader = $loader;
209 209
                 return $this;
210 210
             }
211
-            $loader = __NAMESPACE__ . '\\Loaders\\' . Str::studly($loader);
211
+            $loader = __NAMESPACE__.'\\Loaders\\'.Str::studly($loader);
212 212
             if (class_exists($loader) && in_array(DictLoader::class, class_implements($loader))) {
213 213
                 $this->loader = $loader;
214 214
                 return $this;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function setDataPath(?string $path): self
242 242
     {
243
-        $path = $path ?? dirname(__DIR__) . '/data/';
243
+        $path = $path ?? dirname(__DIR__).'/data/';
244 244
         if (!is_dir($path)) {
245 245
             throw new InvalidArgumentException(sprintf('\'%s\' is not valid data path.', $path));
246 246
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $string = $this->convertSurname($string, $dictLoader);
267 267
         }
268 268
 
269
-        $dictLoader->map(function ($dictionary) use (&$string) {
269
+        $dictLoader->map(function($dictionary) use (&$string) {
270 270
             $string = strtr($string, $dictionary);
271 271
         });
272 272
 
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
      */
284 284
     protected function convertSurname(string $string, DictLoader $dictLoader): string
285 285
     {
286
-        $dictLoader->mapSurname(function ($dictionary) use (&$string) {
286
+        $dictLoader->mapSurname(function($dictionary) use (&$string) {
287 287
             foreach ($dictionary as $surname => $pinyin) {
288 288
                 if (0 === strpos($string, $surname)) {
289
-                    $string = $pinyin . mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
289
+                    $string = $pinyin.mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
290 290
 
291 291
                     break;
292 292
                 }
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
      */
343 343
     protected function prepare(string $string, int $option = self::DEFAULT): string
344 344
     {
345
-        $string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) {
346
-            return "\t" . $matches[0];
345
+        $string = preg_replace_callback('~[a-z0-9_-]+~i', function($matches) {
346
+            return "\t".$matches[0];
347 347
         }, $string);
348 348
 
349 349
         $regex = ['\p{Han}', '\p{Z}', '\p{M}', "\t"];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                     $umlaut = 'v';
393 393
                 }
394 394
 
395
-                $pinyin = str_replace($unicode, $umlaut, $pinyin) . ($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
395
+                $pinyin = str_replace($unicode, $umlaut, $pinyin).($this->hasOption($option, self::ASCII_TONE) ? $replacement[1] : '');
396 396
             }
397 397
         }
398 398
 
Please login to merge, or discard this patch.