@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -return array ( |
|
| 2 | +return array( |
|
| 3 | 3 | '万俟' => ' mò qí ', |
| 4 | 4 | '尉迟' => ' yù chí ', |
| 5 | 5 | '单于' => ' chán yú ', |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | class Pinyin |
| 18 | 18 | { |
| 19 | 19 | private const SEGMENTS_COUNT = 10; |
| 20 | - private const WORDS_PATH = __DIR__.'/../data/words-%s.php'; |
|
| 21 | - private const SURNAMES_PATH = __DIR__.'/../data/surnames.php'; |
|
| 20 | + private const WORDS_PATH = __DIR__ . '/../data/words-%s.php'; |
|
| 21 | + private const SURNAMES_PATH = __DIR__ . '/../data/surnames.php'; |
|
| 22 | 22 | |
| 23 | 23 | protected array $punctuations = [ |
| 24 | 24 | ',' => ',', |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | list($option, $delimiter) = [$delimiter, '']; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - return implode($delimiter, array_map(function ($pinyin) { |
|
| 80 | + return implode($delimiter, array_map(function($pinyin) { |
|
| 81 | 81 | return \is_numeric($pinyin) || preg_match('/\d+/', $pinyin) ? $pinyin : mb_substr($pinyin, 0, 1); |
| 82 | 82 | }, $this->convert($string, $option | \PINYIN_NO_TONE))); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function phrase(string $string, string|int $delimiter = ' ', int|string $option = null): string |
|
| 85 | + public function phrase(string $string, string | int $delimiter = ' ', int | string $option = null): string |
|
| 86 | 86 | { |
| 87 | 87 | $option = $option ?? $this->defaultOptions; |
| 88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return implode($delimiter, $this->convert($string, $option)); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function sentence(string $string, string|int $delimiter = ' ', int|string $option = null): string |
|
| 96 | + public function sentence(string $string, string | int $delimiter = ' ', int | string $option = null): string |
|
| 97 | 97 | { |
| 98 | 98 | $option = $option ?? $this->defaultOptions; |
| 99 | 99 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | protected function prepare(string $string, int $option): string |
| 155 | 155 | { |
| 156 | - $string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) { |
|
| 156 | + $string = preg_replace_callback('~[a-z0-9_-]+~i', function($matches) { |
|
| 157 | 157 | return "\t" . $matches[0]; |
| 158 | 158 | }, $string); |
| 159 | 159 | |