@@ -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 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function register() |
| 33 | 33 | { |
| 34 | - $this->app->singleton('translug', function () { |
|
| 34 | + $this->app->singleton('translug', function() { |
|
| 35 | 35 | return new Translation(new Client(), config('services.youdao')); |
| 36 | 36 | }); |
| 37 | 37 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if ((int) $translateResponse['errorCode'] === 0) { |
| 86 | 86 | return $this->getTranslatedTextFromResponse($translateResponse); |
| 87 | 87 | } |
| 88 | - throw new TranslationErrorException('Translate error, error_code : '.$translateResponse['errorCode'].'. Refer url: http://ai.youdao.com/docs/api.s'); |
|
| 88 | + throw new TranslationErrorException('Translate error, error_code : ' . $translateResponse['errorCode'] . '. Refer url: http://ai.youdao.com/docs/api.s'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $salt = md5(time()); |
| 109 | 109 | $query = [ |
| 110 | - 'sign' => md5($this->config['appKey'].$text.$salt.$this->config['appSecret']), |
|
| 110 | + 'sign' => md5($this->config['appKey'] . $text . $salt . $this->config['appSecret']), |
|
| 111 | 111 | 'appKey' => $this->config['appKey'], |
| 112 | 112 | 'salt' => $salt, |
| 113 | 113 | ]; |
| 114 | 114 | |
| 115 | - return $this->api.http_build_query($query).'&q='.urlencode($text); |
|
| 115 | + return $this->api . http_build_query($query) . '&q=' . urlencode($text); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |