34
34
define ('PINYIN_KEEP_PUNCTUATION ' , 256 );
35
35
36
36
/**
37
- * Class Pinyin
37
+ * Class Pinyin.
38
38
*
39
39
* @author overtrue <[email protected] >
40
40
*/
@@ -62,7 +62,7 @@ class Pinyin
62
62
'” ' => '" ' ,
63
63
'‘ ' => "' " ,
64
64
'’ ' => "' " ,
65
- '_ ' => " _ " ,
65
+ '_ ' => ' _ ' ,
66
66
);
67
67
68
68
/**
@@ -180,7 +180,7 @@ public function sentence($string, $delimiter = ' ', $option = \PINYIN_NO_TONE)
180
180
list ($ option , $ delimiter ) = array ($ delimiter , ' ' );
181
181
}
182
182
183
- return implode ($ delimiter , $ this ->convert ($ string , $ option | \PINYIN_KEEP_PUNCTUATION | \PINYIN_KEEP_ENGLISH | \PINYIN_KEEP_NUMBER ));;
183
+ return implode ($ delimiter , $ this ->convert ($ string , $ option | \PINYIN_KEEP_PUNCTUATION | \PINYIN_KEEP_ENGLISH | \PINYIN_KEEP_NUMBER ));
184
184
}
185
185
186
186
/**
@@ -325,7 +325,7 @@ protected function prepare($string, $option = \PINYIN_DEFAULT)
325
325
\array_push ($ regex , preg_quote (implode (array_merge (array_keys ($ this ->punctuations ), $ this ->punctuations )), '~ ' ));
326
326
}
327
327
328
- return preg_replace (\sprintf (" ~[^%s]~u " , join ($ regex )), '' , $ string );
328
+ return preg_replace (\sprintf (' ~[^%s]~u ' , implode ($ regex )), '' , $ string );
329
329
}
330
330
331
331
/**
@@ -351,7 +351,7 @@ protected function formatTone($pinyin, $option = \PINYIN_NO_TONE)
351
351
$ umlaut = $ replacement [0 ];
352
352
353
353
// https://zh.wikipedia.org/wiki/%C3%9C
354
- if ($ this ->hasOption ($ option , \PINYIN_UMLAUT_V ) && $ umlaut == ' yu ' ) {
354
+ if ($ this ->hasOption ($ option , \PINYIN_UMLAUT_V ) && ' yu ' == $ umlaut ) {
355
355
$ umlaut = 'v ' ;
356
356
}
357
357
0 commit comments