@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | } |
199 | 199 | $checkfilestart($file, count($sentences)); |
200 | 200 | $sentences = $this->checkSentences( |
201 | - $sentences, |
|
202 | - $checksentence |
|
201 | + $sentences, |
|
202 | + $checksentence |
|
203 | 203 | ); |
204 | 204 | $htmlcode = $this->convertToHtml($file->getFilename(), $sentences); |
205 | 205 | |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | $sentences = $html->getSentences(); |
247 | 247 | $checkfilestart($file, count($sentences)); |
248 | 248 | $sentences = $this->checkSentences( |
249 | - $sentences, |
|
250 | - $checksentence |
|
249 | + $sentences, |
|
250 | + $checksentence |
|
251 | 251 | ); |
252 | 252 | $htmlcode = $this->convertToHtml($title, $sentences); |
253 | 253 | |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | $sentencesChecked = []; |
278 | 278 | foreach ($sentences as $sentence) { |
279 | 279 | $response = $this->languagetoolClientHttp->get( |
280 | - $url, |
|
281 | - [ |
|
282 | - 'query' => [ |
|
283 | - 'language' => $this->languageToolLanguage, |
|
284 | - 'text' => $sentence |
|
285 | - ] |
|
286 | - ] |
|
280 | + $url, |
|
281 | + [ |
|
282 | + 'query' => [ |
|
283 | + 'language' => $this->languageToolLanguage, |
|
284 | + 'text' => $sentence |
|
285 | + ] |
|
286 | + ] |
|
287 | 287 | ); |
288 | 288 | $xml = $response->getBody()->getContents(); |
289 | 289 | $glxml = new GlHtml($xml); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if (extension_loaded('enchant')) { |
93 | 93 | $this->enchantBroker = enchant_broker_init(); |
94 | 94 | |
95 | - enchant_broker_set_dict_path($this->enchantBroker, ENCHANT_MYSPELL, __DIR__ . '/../dicts'); |
|
95 | + enchant_broker_set_dict_path($this->enchantBroker, ENCHANT_MYSPELL, __DIR__.'/../dicts'); |
|
96 | 96 | |
97 | 97 | if (!enchant_broker_dict_exists($this->enchantBroker, $this->enchantLanguage)) { |
98 | 98 | throw new \Exception("Cannot find dictionnaries for enchant"); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $html = '<!DOCTYPE HTML>'; |
123 | 123 | $html .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; |
124 | - $html .= '<title>' . $title . '</title>'; |
|
124 | + $html .= '<title>'.$title.'</title>'; |
|
125 | 125 | $html .= '<style>'; |
126 | 126 | $html .= '.error { color: red }'; |
127 | 127 | $html .= '</style>'; |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | $tooltip = $error->getMessage(); |
149 | 149 | $suggs = $error->getSuggestions(); |
150 | 150 | if (count($suggs) > 0) { |
151 | - $tooltip .= " : " . $suggs[0]; |
|
151 | + $tooltip .= " : ".$suggs[0]; |
|
152 | 152 | } |
153 | 153 | $zone = mb_substr($text, $offset, $length, 'UTF-8'); |
154 | - $cons .= '<span class="error" title="' . $tooltip . '">' . $zone . '</span>'; |
|
154 | + $cons .= '<span class="error" title="'.$tooltip.'">'.$zone.'</span>'; |
|
155 | 155 | |
156 | 156 | $start = $offset + $length; |
157 | 157 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | $sentences, |
202 | 202 | $checksentence |
203 | 203 | ); |
204 | - $htmlcode = $this->convertToHtml($file->getFilename(), $sentences); |
|
204 | + $htmlcode = $this->convertToHtml($file->getFilename(), $sentences); |
|
205 | 205 | |
206 | - $checkerfile = sys_get_temp_dir() . "/" . uniqid("spellcheck") . ".html"; |
|
206 | + $checkerfile = sys_get_temp_dir()."/".uniqid("spellcheck").".html"; |
|
207 | 207 | file_put_contents($checkerfile, $htmlcode); |
208 | 208 | $results[] = $checkerfile; |
209 | 209 | |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | $sentences, |
250 | 250 | $checksentence |
251 | 251 | ); |
252 | - $htmlcode = $this->convertToHtml($title, $sentences); |
|
252 | + $htmlcode = $this->convertToHtml($title, $sentences); |
|
253 | 253 | |
254 | - $checkerfile = sys_get_temp_dir() . "/" . uniqid("spellcheck") . ".html"; |
|
254 | + $checkerfile = sys_get_temp_dir()."/".uniqid("spellcheck").".html"; |
|
255 | 255 | file_put_contents($checkerfile, $htmlcode); |
256 | 256 | $results[] = $checkerfile; |
257 | 257 | |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | ] |
286 | 286 | ] |
287 | 287 | ); |
288 | - $xml = $response->getBody()->getContents(); |
|
288 | + $xml = $response->getBody()->getContents(); |
|
289 | 289 | $glxml = new GlHtml($xml); |
290 | 290 | $errors = $glxml->get('error'); |
291 | 291 | $sentenceChecked = new GlSpellCheckerSentence($sentence); |
292 | 292 | if (count($errors) > 0) { |
293 | 293 | foreach ($errors as $error) { |
294 | 294 | $msg = $error->getAttribute('msg'); |
295 | - $offset = (int)$error->getAttribute('offset'); |
|
296 | - $length = (int)$error->getAttribute('errorlength'); |
|
295 | + $offset = (int) $error->getAttribute('offset'); |
|
296 | + $length = (int) $error->getAttribute('errorlength'); |
|
297 | 297 | $suggs = []; |
298 | 298 | $word = null; |
299 | 299 | if ($error->getAttribute('locqualityissuetype') == 'misspelling') { |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | private function startLanguageToolServer($directory) |
323 | 323 | { |
324 | - $jar = $directory . "languagetool-server.jar"; |
|
324 | + $jar = $directory."languagetool-server.jar"; |
|
325 | 325 | $command = "java -cp $jar org.languagetool.server.HTTPServer --port {$this->languageToolServerPort}"; |
326 | 326 | $this->languagetoolServer = new Process($command); |
327 | 327 | $this->languagetoolServer->start(); |