@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | |
244 | 244 | /** |
245 | - * @param \Exception|\Throwable $e |
|
245 | + * @param \Exception $e |
|
246 | 246 | */ |
247 | 247 | public function choiceError($e, $domain) |
248 | 248 | { |
@@ -359,6 +359,7 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * Returns link to editor. |
361 | 361 | * @author David Grudl |
362 | + * @param string $text |
|
362 | 363 | * @return Nette\Utils\Html|string |
363 | 364 | */ |
364 | 365 | private static function editorLink($file, $line, $text = NULL) |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function getTab() |
92 | 92 | { |
93 | 93 | return '<span title="Translation"><img width="16px" height="16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90DExAuL9uIsPUAAAQ2SURBVFjD7Ze9bxxVFMV/583skjgOIXEaKCNFAgmQ+ExS8qEUCEHH30BBScG/QM1fEmgoAAkoAigSKKFASElHESEFbGcdez7uoXhvZteW7ewmQjRMsTs7s/Pufeece+4d+P/4jw8ddvHq1avv2b5mm02Lr9Y7/gpQBCFDD5YhgsAoRLhHMtHnRYNAAb3yt92//9y3v3x+MFY6LIGIuGYbKedngzAGsPK5Kb8BGRAu9xiuL+zQ6NphsQ5NYB7YhA1jQCObyOHG/3sMlpM0hmGNcmXh7w9PYL5wfsphbCMPaOR7BipEJahV0FHZvZ2D+1i2qY+gYERCZTGZzLdFkLNIht/v72AHGM5Pa85MqowUc4p81PaPo2CgIa9RxOZ8jowDZm0WXo2oBdttN8ihIABC5dPLI7BIQQA5prEGIeYdbnVtSSpD3WCaCCqpMB8jXSshEBFEROZ9TCTvepC/be63HWA2ppNRoJttP1flvkp5BArmNBQl5zSIMJtNRxJEwHqVOF1XGLHVdSQp+0CpAi1UytJVYHteBQ7cm7AgIKnAH7CWhBDrVRqfud91UERLFNPyihQMwaOUIAI5I9D0PU2Xz9frCjs4WVVUMhJstR2SwaUWgvx7VQqyG2b4IoIoO9xsWipllJ6sK1JB7Exd4whmbUcYlCVcRKrVq0DSqCIVRlPZ4SCqO7MHC0Ey1Epiu+k5XafMvbRaFXCgdBxBOIgw202/TyNBtmuHibJRYba6LjuAsgjjCA3UxwWPCEwanRCJ7bYd/eHspFootdwhdvqeJsyegyaCSVK271US2E9BNp8otbTd9STlB89NJvRFmJREJ4K7e0El2Op6NiY1x7GQlpoawihgq+lIZF2s1xWdu9GAcO6Yp6rcE4OcwGDGR7nhUglYRjL32pbOQdMH61VCzgiFc8eUs+2cTIkuoI2MmH20D9TLzEzuTafgwtp0dNXO5FlhsOvSh23zzBPTBfDm4ny0BBBWAInWpSmVmSDzqrEko0TpBwct9W+xGgKL41hWoMeJB/LQsa/JlOYkVDrmAHlpwnF0M6of2gdIC7vUvDUNk1HMbwVRbmo+jA3tOlaYByTYbRJdiG1E3UFFg2IvLxqm67qR1yg71kLflDXvwhHhsxtbSycw2xWffXiPP+/NmFTiGyX21t9m99RbWDCZ1Fy5dAlJeXyz6aOfz48Mzli6aPTp8rMXz/585UVeun7z4WW418Kll0/w9Pk1/t5JTHdh2otpElMl1PX8eP06fdus9ObhQ2g4VBrVxpvvdl/Ovmgacev2Dnf+2GXnxi6zGw/KMJrNJUXPS6fXmCaNw+d8GNV8KHXgp87xyg83tVQCALPvLlvCVUK/3tnh9t3mkw8+/u3Tx3kNu/H6C7z6063lnLBU4dd98NHzF9Z47eKpE4/7Hngw+LHHzveX3zmAyBv/xsvpP+li/lm3bxkuAAAAAElFTkSuQmCC" />' |
94 | - . $this->translator->getLocale() . ($this->untranslated ? ' <b>(' . count(array_unique($this->untranslated, SORT_REGULAR)) . ' errors)</b>' : '') |
|
94 | + . $this->translator->getLocale().($this->untranslated ? ' <b>('.count(array_unique($this->untranslated, SORT_REGULAR)).' errors)</b>' : '') |
|
95 | 95 | . '</span>'; |
96 | 96 | } |
97 | 97 | |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | |
125 | 125 | /** @var Request[] $snapshot */ |
126 | 126 | $params = $snapshot['request']->getParameters(); |
127 | - $s .= '<tr><th width="10px"> </th>' . |
|
128 | - '<th>' . $h($snapshot['request']->getPresenterName() . (isset($params['action']) ? ':' . $params['action'] : '')) . '</th>' . |
|
129 | - '<th>' . $h($snapshot['locale']) . '</th></tr>'; |
|
127 | + $s .= '<tr><th width="10px"> </th>'. |
|
128 | + '<th>'.$h($snapshot['request']->getPresenterName().(isset($params['action']) ? ':'.$params['action'] : '')).'</th>'. |
|
129 | + '<th>'.$h($snapshot['locale']).'</th></tr>'; |
|
130 | 130 | |
131 | 131 | $l = 1; |
132 | 132 | foreach ($snapshot['resolvers'] as $name => $resolvedLocale) { |
133 | - $s .= '<tr><td>' . ($l++) . '.</td><td>' . $h($name) . '</td><td>' . $h($resolvedLocale) . '</td></tr>'; |
|
133 | + $s .= '<tr><td>'.($l++).'.</td><td>'.$h($name).'</td><td>'.$h($resolvedLocale).'</td></tr>'; |
|
134 | 134 | } |
135 | 135 | |
136 | - $panel[] = '<table style="width:100%">' . $s . '</table>'; |
|
136 | + $panel[] = '<table style="width:100%">'.$s.'</table>'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -151,14 +151,13 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | $panel[] = '<h2>Ignored resources</h2>'; |
154 | - $panel[] = '<p>Whitelist config: ' . implode(', ', array_map($h, $this->localeWhitelist)) . '</p>'; |
|
154 | + $panel[] = '<p>Whitelist config: '.implode(', ', array_map($h, $this->localeWhitelist)).'</p>'; |
|
155 | 155 | $panel[] = $this->renderResources($this->ignoredResources); |
156 | 156 | } |
157 | 157 | |
158 | - return empty($panel) ? '' : |
|
159 | - '<h1>Missing translations: ' . count(array_unique($this->untranslated, SORT_REGULAR)) . |
|
160 | - ', Resources: ' . count(Nette\Utils\Arrays::flatten($this->resources)) . '</h1>' . |
|
161 | - '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . |
|
158 | + return empty($panel) ? '' : '<h1>Missing translations: '.count(array_unique($this->untranslated, SORT_REGULAR)). |
|
159 | + ', Resources: '.count(Nette\Utils\Arrays::flatten($this->resources)).'</h1>'. |
|
160 | + '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">'.implode($panel).'</div>'. |
|
162 | 161 | '<style> |
163 | 162 | #nette-debug .kdyby-TranslationPanel h2, |
164 | 163 | #tracy-debug .kdyby-TranslationPanel h2 {font-size: 23px;} |
@@ -178,19 +177,19 @@ discard block |
||
178 | 177 | $s .= '<tr><td>'; |
179 | 178 | |
180 | 179 | if ($message instanceof \Exception || $message instanceof \Throwable) { |
181 | - $s .= '<span style="color:red">' . $h($message->getMessage()) . '</span>'; |
|
180 | + $s .= '<span style="color:red">'.$h($message->getMessage()).'</span>'; |
|
182 | 181 | |
183 | 182 | } elseif ($message instanceof Nette\Utils\Html) { |
184 | - $s .= '<span style="color:red">Nette\Utils\Html(' . $h((string) $message) . ')</span>'; |
|
183 | + $s .= '<span style="color:red">Nette\Utils\Html('.$h((string) $message).')</span>'; |
|
185 | 184 | |
186 | 185 | } else { |
187 | 186 | $s .= $h($message); |
188 | 187 | } |
189 | 188 | |
190 | - $s .= '</td><td>' . $h($untranslated['domain']) . '</td></tr>'; |
|
189 | + $s .= '</td><td>'.$h($untranslated['domain']).'</td></tr>'; |
|
191 | 190 | } |
192 | 191 | |
193 | - return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>' . $s . '</table>'; |
|
192 | + return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>'.$s.'</table>'; |
|
194 | 193 | } |
195 | 194 | |
196 | 195 | |
@@ -204,25 +203,25 @@ discard block |
||
204 | 203 | foreach ($resourcesMap as $locale => $resources) { |
205 | 204 | foreach ($resources as $resourcePath => $domain) { |
206 | 205 | $s .= '<tr>'; |
207 | - $s .= '<td>' . $h($locale) . '</td>'; |
|
208 | - $s .= '<td>' . $h($domain) . '</td>'; |
|
206 | + $s .= '<td>'.$h($locale).'</td>'; |
|
207 | + $s .= '<td>'.$h($domain).'</td>'; |
|
209 | 208 | |
210 | - $relativePath = str_replace(rtrim($this->rootDir, '/') . '/', '', $resourcePath); |
|
209 | + $relativePath = str_replace(rtrim($this->rootDir, '/').'/', '', $resourcePath); |
|
211 | 210 | if (Nette\Utils\Strings::startsWith($relativePath, 'vendor/')) { |
212 | 211 | $parts = explode('/', $relativePath, 4); |
213 | 212 | $left = array_pop($parts); |
214 | - $relativePath = $h(implode('/', $parts) . '/.../') . '<b>' . $h(basename($left)) . '</b>'; |
|
213 | + $relativePath = $h(implode('/', $parts).'/.../').'<b>'.$h(basename($left)).'</b>'; |
|
215 | 214 | |
216 | 215 | } else { |
217 | - $relativePath = $h(dirname($relativePath)) . '/<b>' . $h(basename($relativePath)) . '</b>'; |
|
216 | + $relativePath = $h(dirname($relativePath)).'/<b>'.$h(basename($relativePath)).'</b>'; |
|
218 | 217 | } |
219 | 218 | |
220 | - $s .= '<td>' . self::editorLink($resourcePath, 1, $relativePath) . '</td>'; |
|
219 | + $s .= '<td>'.self::editorLink($resourcePath, 1, $relativePath).'</td>'; |
|
221 | 220 | $s .= '</tr>'; |
222 | 221 | } |
223 | 222 | } |
224 | 223 | |
225 | - return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>' . $s . '</table>'; |
|
224 | + return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>'.$s.'</table>'; |
|
226 | 225 | } |
227 | 226 | |
228 | 227 | |
@@ -347,9 +346,9 @@ discard block |
||
347 | 346 | if ($call = Helpers::findTrace($e->getPrevious()->getTrace(), $method)) { |
348 | 347 | return [ |
349 | 348 | 'tab' => 'YAML dictionary', |
350 | - 'panel' => '<p><b>File:</b> ' . self::editorLink($call['args'][0], $previous->getParsedLine()) . '</p>' |
|
349 | + 'panel' => '<p><b>File:</b> '.self::editorLink($call['args'][0], $previous->getParsedLine()).'</p>' |
|
351 | 350 | . ($previous->getParsedLine() ? BlueScreen::highlightFile($call['args'][0], $previous->getParsedLine()) : '') |
352 | - . '<p>' . $previous->getMessage() . ' </p>' |
|
351 | + . '<p>'.$previous->getMessage().' </p>' |
|
353 | 352 | ]; |
354 | 353 | } |
355 | 354 | } |
@@ -95,8 +95,8 @@ |
||
95 | 95 | { |
96 | 96 | foreach ($this->getLoaders() as $format => $loader) { |
97 | 97 | // load any existing translation files |
98 | - $extension = $catalogue->getLocale() . '.' . $format; |
|
99 | - foreach (Finder::findFiles('*.' . $extension)->from($directory) as $file) { |
|
98 | + $extension = $catalogue->getLocale().'.'.$format; |
|
99 | + foreach (Finder::findFiles('*.'.$extension)->from($directory) as $file) { |
|
100 | 100 | /** @var \SplFileInfo $file */ |
101 | 101 | $domain = substr($file->getFileName(), 0, -1 * strlen($extension) - 1); |
102 | 102 | $this->loadResource($format, $file->getPathname(), $domain, $catalogue); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | if (!$this->session->isStarted() && $this->httpResponse->isSent()) { |
78 | 78 | trigger_error( |
79 | - "The advice of session locale resolver is required but the session has not been started and headers had been already sent. " . |
|
79 | + "The advice of session locale resolver is required but the session has not been started and headers had been already sent. ". |
|
80 | 80 | "Either start your sessions earlier or disabled the SessionResolver.", |
81 | 81 | E_USER_WARNING |
82 | 82 | ); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return NULL; |
88 | 88 | } |
89 | 89 | |
90 | - $short = array_map(function ($locale) { |
|
90 | + $short = array_map(function($locale) { |
|
91 | 91 | return substr($locale, 0, 2); |
92 | 92 | }, $translator->getAvailableLocales()); |
93 | 93 |
@@ -65,10 +65,10 @@ |
||
65 | 65 | return NULL; |
66 | 66 | } |
67 | 67 | |
68 | - $s = strtolower($header); // case insensitive |
|
69 | - $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
70 | - rsort($langs); // first more specific |
|
71 | - preg_match_all('#(' . implode('|', $langs) . ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches); |
|
68 | + $s = strtolower($header); // case insensitive |
|
69 | + $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
70 | + rsort($langs); // first more specific |
|
71 | + preg_match_all('#('.implode('|', $langs).')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches); |
|
72 | 72 | |
73 | 73 | if (!$matches[0]) { |
74 | 74 | return NULL; |
@@ -54,10 +54,10 @@ |
||
54 | 54 | { |
55 | 55 | return parent::getCacheFile(substr_replace( |
56 | 56 | $key, |
57 | - trim(strtr($this->hint, '\\/@', '.._'), '.') . '-', |
|
57 | + trim(strtr($this->hint, '\\/@', '.._'), '.').'-', |
|
58 | 58 | strpos($key, Nette\Caching\Cache::NAMESPACE_SEPARATOR) + 1, |
59 | 59 | 0 |
60 | - )) . '.php'; |
|
60 | + )).'.php'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | , $locale, $availableCatalogues[$locale]->all(), new Code\PhpLiteral($fallbackContent) |
162 | 162 | ); |
163 | 163 | |
164 | - return '<?php' . "\n\n" . $content; |
|
164 | + return '<?php'."\n\n".$content; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 |
@@ -27,6 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param string $format The format of the loader |
29 | 29 | * @param LoaderInterface $loader |
30 | + * @return void |
|
30 | 31 | */ |
31 | 32 | public function addLoader($format, LoaderInterface $loader); |
32 | 33 | |
@@ -45,6 +46,7 @@ discard block |
||
45 | 46 | * @param string $domain |
46 | 47 | * @param MessageCatalogue $catalogue |
47 | 48 | * @throws LoaderNotFoundException |
49 | + * @return void |
|
48 | 50 | */ |
49 | 51 | public function loadResource($format, $resource, $domain, MessageCatalogue $catalogue); |
50 | 52 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | $tmp = []; |
161 | 161 | foreach ($parameters as $key => $val) { |
162 | - $tmp['%' . trim($key, '%') . '%'] = $val; |
|
162 | + $tmp['%'.trim($key, '%').'%'] = $val; |
|
163 | 163 | } |
164 | 164 | $parameters = $tmp; |
165 | 165 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public static function buildWhitelistRegexp($whitelist) |
467 | 467 | { |
468 | - return $whitelist ? '~^(' . implode('|', $whitelist) . ')~i' : NULL; |
|
468 | + return $whitelist ? '~^('.implode('|', $whitelist).')~i' : NULL; |
|
469 | 469 | } |
470 | 470 | |
471 | 471 |
@@ -178,6 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | /** |
180 | 180 | * {@inheritdoc} |
181 | + * @param string $locale |
|
181 | 182 | */ |
182 | 183 | public function trans($message, array $parameters = [], $domain = NULL, $locale = NULL) |
183 | 184 | { |
@@ -208,6 +209,7 @@ discard block |
||
208 | 209 | |
209 | 210 | /** |
210 | 211 | * {@inheritdoc} |
212 | + * @param string $locale |
|
211 | 213 | */ |
212 | 214 | public function transChoice($message, $number, array $parameters = [], $domain = NULL, $locale = NULL) |
213 | 215 | { |
@@ -332,6 +334,7 @@ discard block |
||
332 | 334 | |
333 | 335 | /** |
334 | 336 | * {@inheritdoc} |
337 | + * @return string |
|
335 | 338 | */ |
336 | 339 | public function getLocale() |
337 | 340 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function translate($message, $count = NULL, $parameters = [], $domain = NULL, $locale = NULL) |
63 | 63 | { |
64 | 64 | $translationString = ($message instanceof Phrase ? $message->message : $message); |
65 | - $prefix = $this->prefix . '.'; |
|
65 | + $prefix = $this->prefix.'.'; |
|
66 | 66 | |
67 | 67 | if (Strings::startsWith($message, '//')) { |
68 | 68 | $prefix = NULL; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($message instanceof Phrase) { |
73 | - return $this->translator->translate(new Phrase($prefix . $translationString, $message->count, $message->parameters, $message->domain, $message->locale)); |
|
73 | + return $this->translator->translate(new Phrase($prefix.$translationString, $message->count, $message->parameters, $message->domain, $message->locale)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if (is_array($count)) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $count = NULL; |
81 | 81 | } |
82 | 82 | |
83 | - return $this->translator->translate($prefix . $translationString, $count, (array) $parameters, $domain, $locale); |
|
83 | + return $this->translator->translate($prefix.$translationString, $count, (array) $parameters, $domain, $locale); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 |