@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function register() |
| 34 | 34 | { |
| 35 | - $this->app->singleton('translug', function () { |
|
| 35 | + $this->app->singleton('translug', function() { |
|
| 36 | 36 | return new Translation(new Client()); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -72,11 +72,11 @@ |
||
| 72 | 72 | { |
| 73 | 73 | $flip = $separator == '-' ? '_' : '-'; |
| 74 | 74 | |
| 75 | - $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); |
|
| 75 | + $title = preg_replace('![' . preg_quote($flip) . ']+!u', $separator, $title); |
|
| 76 | 76 | |
| 77 | - $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); |
|
| 77 | + $title = preg_replace('![^' . preg_quote($separator) . '\pL\pN\s]+!u', '', mb_strtolower($title)); |
|
| 78 | 78 | |
| 79 | - $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); |
|
| 79 | + $title = preg_replace('![' . preg_quote($separator) . '\s]+!u', $separator, $title); |
|
| 80 | 80 | |
| 81 | 81 | return trim($title, $separator); |
| 82 | 82 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $this->getTranslatedTextFromResponse($translateResponse); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - throw new TranslationErrorException('Translate error, error_code : '.$translateResponse['errorCode'].'. Refer url: http://fanyi.youdao.com/openapi?path=data-mode'); |
|
| 99 | + throw new TranslationErrorException('Translate error, error_code : ' . $translateResponse['errorCode'] . '. Refer url: http://fanyi.youdao.com/openapi?path=data-mode'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $query = http_build_query($this->config); |
| 120 | 120 | |
| 121 | - return $this->api.$query.'&q='.urlencode($text); |
|
| 121 | + return $this->api . $query . '&q=' . urlencode($text); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $query = http_build_query(['salt' => $salt, 'sign' => $sign, 'appKey' => $key]); |
| 138 | 138 | |
| 139 | - return $this->api_v2.$query.'&q='.urlencode($text); |
|
| 139 | + return $this->api_v2 . $query . '&q=' . urlencode($text); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |