Skip to content

Commit 49153c3

Browse files
committed
CS.
1 parent 2237033 commit 49153c3

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/FileDictLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($path)
3838
public function map(Closure $callback)
3939
{
4040
for ($i = 0; $i < 100; ++$i) {
41-
$segment = $this->path.'/'.sprintf($this->segmentName, $i);
41+
$segment = $this->path . '/' . sprintf($this->segmentName, $i);
4242

4343
if (file_exists($segment)) {
4444
$dictionary = (array) include $segment;
@@ -54,7 +54,7 @@ public function map(Closure $callback)
5454
*/
5555
public function mapSurname(Closure $callback)
5656
{
57-
$surnames = $this->path.'/surnames';
57+
$surnames = $this->path . '/surnames';
5858

5959
if (file_exists($surnames)) {
6060
$dictionary = (array) include $surnames;

src/GeneratorFileDictLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct($path)
4646
$this->path = $path;
4747

4848
for ($i = 0; $i < 100; ++$i) {
49-
$segment = $this->path.'/'.sprintf($this->segmentName, $i);
49+
$segment = $this->path . '/' . sprintf($this->segmentName, $i);
5050

5151
if (file_exists($segment) && is_file($segment)) {
5252
array_push(static::$handles, $this->openFile($segment));
@@ -125,7 +125,7 @@ public function map(Closure $callback)
125125
public function mapSurname(Closure $callback)
126126
{
127127
if (!static::$surnamesHandle instanceof SplFileObject) {
128-
static::$surnamesHandle = $this->openFile($this->path.'/surnames');
128+
static::$surnamesHandle = $this->openFile($this->path . '/surnames');
129129
}
130130

131131
$this->traversing($this->getGenerator([static::$surnamesHandle]), $callback);

src/MemoryFileDictLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($path)
4444
$this->path = $path;
4545

4646
for ($i = 0; $i < 100; ++$i) {
47-
$segment = $path.'/'.sprintf($this->segmentName, $i);
47+
$segment = $path . '/' . sprintf($this->segmentName, $i);
4848

4949
if (file_exists($segment)) {
5050
$this->segments[] = (array) include $segment;
@@ -72,7 +72,7 @@ public function map(Closure $callback)
7272
public function mapSurname(Closure $callback)
7373
{
7474
if (empty($this->surnames)) {
75-
$surnames = $this->path.'/surnames';
75+
$surnames = $this->path . '/surnames';
7676

7777
if (file_exists($surnames)) {
7878
$this->surnames = (array) include $surnames;

src/Pinyin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function setLoader(DictLoaderInterface $loader)
173173
public function getLoader()
174174
{
175175
if (!($this->loader instanceof DictLoaderInterface)) {
176-
$dataDir = dirname(__DIR__).'/data/';
176+
$dataDir = dirname(__DIR__) . '/data/';
177177

178178
$loaderName = $this->loader;
179179
$this->loader = new $loaderName($dataDir);
@@ -220,7 +220,7 @@ protected function convertSurname($string, $dictLoader)
220220
$dictLoader->mapSurname(function ($dictionary) use (&$string) {
221221
foreach ($dictionary as $surname => $pinyin) {
222222
if (0 === strpos($string, $surname)) {
223-
$string = $pinyin.mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
223+
$string = $pinyin . mb_substr($string, mb_strlen($surname, 'UTF-8'), mb_strlen($string, 'UTF-8') - 1, 'UTF-8');
224224

225225
break;
226226
}
@@ -273,7 +273,7 @@ public function hasOption($option, $check)
273273
protected function prepare($string, $option = \PINYIN_DEFAULT)
274274
{
275275
$string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) {
276-
return "\t".$matches[0];
276+
return "\t" . $matches[0];
277277
}, $string);
278278

279279
$regex = ['\p{Han}', '\p{Z}', '\p{M}', "\t"];
@@ -323,7 +323,7 @@ protected function formatTone($pinyin, $option = \PINYIN_NO_TONE)
323323
$umlaut = 'v';
324324
}
325325

326-
$pinyin = str_replace($unicode, $umlaut, $pinyin).($this->hasOption($option, PINYIN_ASCII_TONE) ? $replacement[1] : '');
326+
$pinyin = str_replace($unicode, $umlaut, $pinyin) . ($this->hasOption($option, PINYIN_ASCII_TONE) ? $replacement[1] : '');
327327
}
328328
}
329329

0 commit comments

Comments
 (0)