@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $html = '<!DOCTYPE HTML>'; |
120 | 120 | $html .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; |
121 | - $html .= '<title>' . $title . '</title>'; |
|
121 | + $html .= '<title>'.$title.'</title>'; |
|
122 | 122 | $html .= '<style>'; |
123 | 123 | $html .= '.error { color: red }'; |
124 | 124 | |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | $tooltip = $error->getMessage(); |
170 | 170 | $suggs = $error->getSuggestions(); |
171 | 171 | if (count($suggs) > 0) { |
172 | - $tooltip .= " : " . $suggs[0]; |
|
172 | + $tooltip .= " : ".$suggs[0]; |
|
173 | 173 | } |
174 | 174 | $zone = mb_substr($text, $offset, $length, 'UTF-8'); |
175 | - $cons .= '<span class="error tooltip" data-tooltip="' . $tooltip . '">' . $zone . '</span>'; |
|
175 | + $cons .= '<span class="error tooltip" data-tooltip="'.$tooltip.'">'.$zone.'</span>'; |
|
176 | 176 | |
177 | 177 | $start = $offset + $length; |
178 | 178 | } |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | $sentences, |
223 | 223 | $checksentence |
224 | 224 | ); |
225 | - $htmlcode = $this->convertToHtml($file->getFilename(), $sentences); |
|
225 | + $htmlcode = $this->convertToHtml($file->getFilename(), $sentences); |
|
226 | 226 | |
227 | - $checkerfile = sys_get_temp_dir() . "/" . uniqid("spellcheck") . ".html"; |
|
227 | + $checkerfile = sys_get_temp_dir()."/".uniqid("spellcheck").".html"; |
|
228 | 228 | file_put_contents($checkerfile, $htmlcode); |
229 | 229 | $results[] = $checkerfile; |
230 | 230 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | $sentences, |
271 | 271 | $checksentence |
272 | 272 | ); |
273 | - $htmlcode = $this->convertToHtml($title, $sentences); |
|
273 | + $htmlcode = $this->convertToHtml($title, $sentences); |
|
274 | 274 | |
275 | - $checkerfile = sys_get_temp_dir() . "/" . uniqid("spellcheck") . ".html"; |
|
275 | + $checkerfile = sys_get_temp_dir()."/".uniqid("spellcheck").".html"; |
|
276 | 276 | file_put_contents($checkerfile, $htmlcode); |
277 | 277 | $results[] = $checkerfile; |
278 | 278 | |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | * @return \GlSpellChecker\GlSpellCheckerSentence |
289 | 289 | */ |
290 | 290 | public function checkSentence($sentence) { |
291 | - $url = "http://{$this->languageToolServerIP}:{$this->languageToolServerPort}/v2/"; |
|
291 | + $url = "http://{$this->languageToolServerIP}:{$this->languageToolServerPort}/v2/"; |
|
292 | 292 | |
293 | - $response = $this->languagetoolClientHttp->post( |
|
293 | + $response = $this->languagetoolClientHttp->post( |
|
294 | 294 | $url, |
295 | 295 | [ |
296 | 296 | 'form_params' => [ |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | $sentenceChecked = new GlSpellCheckerSentence($sentence); |
307 | 307 | foreach ($response['matches'] as $match) { |
308 | 308 | $msg = $match['message']; |
309 | - $offset = (int)$match['offset']; |
|
310 | - $length = (int)$match['length']; |
|
309 | + $offset = (int) $match['offset']; |
|
310 | + $length = (int) $match['length']; |
|
311 | 311 | $replacements = array_values($match['replacements']); |
312 | 312 | $word = null; |
313 | 313 | $glerror = new GlSpellCheckerError($msg, $offset, $length, $word, $replacements); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $url = "http://{$this->languageToolServerIP}:{$this->languageToolServerPort}"; |
333 | 333 | $sentencesChecked = []; |
334 | 334 | foreach ($sentences as $sentence) { |
335 | - $response = $this->languagetoolClientHttp->get( |
|
335 | + $response = $this->languagetoolClientHttp->get( |
|
336 | 336 | $url, |
337 | 337 | [ |
338 | 338 | 'query' => [ |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | if (count($errors) > 0) { |
349 | 349 | foreach ($errors as $error) { |
350 | 350 | $msg = $error->getAttribute('msg'); |
351 | - $offset = (int)$error->getAttribute('offset'); |
|
352 | - $length = (int)$error->getAttribute('errorlength'); |
|
351 | + $offset = (int) $error->getAttribute('offset'); |
|
352 | + $length = (int) $error->getAttribute('errorlength'); |
|
353 | 353 | $suggs = []; |
354 | 354 | $word = null; |
355 | 355 | if ($error->getAttribute('locqualityissuetype') == 'misspelling') { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | private function startLanguageToolServer($directory) |
379 | 379 | { |
380 | - $jar = $directory . "languagetool-server.jar"; |
|
380 | + $jar = $directory."languagetool-server.jar"; |
|
381 | 381 | $command = "java -cp $jar org.languagetool.server.HTTPServer --port {$this->languageToolServerPort}"; |
382 | 382 | $this->languagetoolServer = new Process($command); |
383 | 383 | $this->languagetoolServer->start(); |