@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return $this->getTranslatedTextFromResponse($translateResponse); |
87 | 87 | } |
88 | 88 | |
89 | - throw new TranslationErrorException('Translate error, error_code : '.$translateResponse['errorCode'].'. Refer url: http://fanyi.youdao.com/openapi?path=data-mode'); |
|
89 | + throw new TranslationErrorException('Translate error, error_code : ' . $translateResponse['errorCode'] . '. Refer url: http://fanyi.youdao.com/openapi?path=data-mode'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | if (count($this->config) > 1) { |
110 | 110 | $query = http_build_query($this->config); |
111 | 111 | |
112 | - return $this->api.$query.'&q='.$text; |
|
112 | + return $this->api . $query . '&q=' . $text; |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->api.'keyfrom='.config('services.youdao.from').'&key='.config('services.youdao.key').'&q='.$text; |
|
115 | + return $this->api . 'keyfrom=' . config('services.youdao.from') . '&key=' . config('services.youdao.key') . '&q=' . $text; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -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 | } |