| @@ -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); | 
| @@ -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; | 
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | |
| 183 | 183 | $tmp = []; | 
| 184 | 184 |  		foreach ($parameters as $key => $val) { | 
| 185 | - $tmp['%' . trim($key, '%') . '%'] = $val; | |
| 185 | + $tmp['%'.trim($key, '%').'%'] = $val; | |
| 186 | 186 | } | 
| 187 | 187 | $parameters = $tmp; | 
| 188 | 188 | |
| @@ -514,7 +514,7 @@ discard block | ||
| 514 | 514 | */ | 
| 515 | 515 | public static function buildWhitelistRegexp($whitelist) | 
| 516 | 516 |  	{ | 
| 517 | -		return ($whitelist !== NULL) ? '~^(' . implode('|', $whitelist) . ')~i' : NULL; | |
| 517 | +		return ($whitelist !== NULL) ? '~^('.implode('|', $whitelist).')~i' : NULL; | |
| 518 | 518 | } | 
| 519 | 519 | |
| 520 | 520 | } | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | |
| 71 | 71 |  			if ($token->name === '/_' || ($token->name === '_' && $token->closing === TRUE)) { | 
| 72 | 72 |  				if ($buffer !== NULL) { | 
| 73 | - $catalogue->set(($this->prefix ? $this->prefix . '.' : '') . $buffer, $buffer); | |
| 73 | + $catalogue->set(($this->prefix ? $this->prefix.'.' : '').$buffer, $buffer); | |
| 74 | 74 | $buffer = NULL; | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | $message = substr(trim($message), 1, -1); | 
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | - $catalogue->set(($this->prefix ? $this->prefix . '.' : '') . $message, $message); | |
| 89 | + $catalogue->set(($this->prefix ? $this->prefix.'.' : '').$message, $message); | |
| 90 | 90 | } | 
| 91 | 91 | } | 
| 92 | 92 | } | 
| @@ -78,7 +78,7 @@ discard block | ||
| 78 | 78 |  	{ | 
| 79 | 79 |  		if (!$this->session->isStarted() && $this->httpResponse->isSent()) { | 
| 80 | 80 | trigger_error( | 
| 81 | - 'The advice of session locale resolver is required but the session has not been started and headers had been already sent. ' . | |
| 81 | + 'The advice of session locale resolver is required but the session has not been started and headers had been already sent. '. | |
| 82 | 82 | 'Either start your sessions earlier or disabled the SessionResolver.', | 
| 83 | 83 | E_USER_WARNING | 
| 84 | 84 | ); | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | return NULL; | 
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | -		$short = array_map(function ($locale) { | |
| 92 | +		$short = array_map(function($locale) { | |
| 93 | 93 | return substr($locale, 0, 2); | 
| 94 | 94 | }, $translator->getAvailableLocales()); | 
| 95 | 95 | |
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | $value = var_export($node->content, TRUE); | 
| 45 | 45 | $node->content = ''; | 
| 46 | 46 |  			} else { | 
| 47 | -				$node->openingCode = '<?php ob_start(function () {}) ?>' . $node->openingCode; | |
| 47 | +				$node->openingCode = '<?php ob_start(function () {}) ?>'.$node->openingCode; | |
| 48 | 48 | $value = 'ob_get_clean()'; | 
| 49 | 49 | } | 
| 50 | 50 | |
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 |  				throw new \Latte\CompileException('Expected message prefix, none given'); | 
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | -			return $writer->write('$_translator = ' . PrefixedTranslator::class . '::register($this, %node.word);'); | |
| 82 | +			return $writer->write('$_translator = '.PrefixedTranslator::class.'::register($this, %node.word);'); | |
| 83 | 83 | } | 
| 84 | 84 | } | 
| 85 | 85 | |
| @@ -47,12 +47,12 @@ | ||
| 47 | 47 |  	{ | 
| 48 | 48 | $cacheKey = substr_replace( | 
| 49 | 49 | $key, | 
| 50 | - trim(strtr($this->hint, '\\/@', '.._'), '.') . '-', | |
| 50 | + trim(strtr($this->hint, '\\/@', '.._'), '.').'-', | |
| 51 | 51 | strpos($key, Cache::NAMESPACE_SEPARATOR) + 1, | 
| 52 | 52 | 0 | 
| 53 | 53 | ); | 
| 54 | 54 | |
| 55 | - return parent::getCacheFile($cacheKey) . '.php'; | |
| 55 | + return parent::getCacheFile($cacheKey).'.php'; | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | } | 
| @@ -150,7 +150,7 @@ | ||
| 150 | 150 | EOF | 
| 151 | 151 | , $locale, $availableCatalogues[$locale]->all(), new PhpLiteral($fallbackContent)); | 
| 152 | 152 | |
| 153 | - return '<?php' . "\n\n" . $content; | |
| 153 | + return '<?php'."\n\n".$content; | |
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | 156 | /** | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | public function getTab(): ?string | 
| 84 | 84 |  	{ | 
| 85 | 85 | 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" />' | 
| 86 | -			. $this->translator->getLocale() . ($this->untranslated ? ' <b>(' . count(array_unique($this->untranslated, SORT_REGULAR)) . ' errors)</b>' : '') | |
| 86 | +			. $this->translator->getLocale().($this->untranslated ? ' <b>('.count(array_unique($this->untranslated, SORT_REGULAR)).' errors)</b>' : '') | |
| 87 | 87 | . '</span>'; | 
| 88 | 88 | } | 
| 89 | 89 | |
| @@ -114,17 +114,17 @@ discard block | ||
| 114 | 114 | |
| 115 | 115 | /** @var \Nette\Application\Request[] $snapshot */ | 
| 116 | 116 | $params = $snapshot['request']->getParameters(); | 
| 117 | - $s .= '<tr><th width="10px"> </th>' . | |
| 118 | - '<th>' . $h($snapshot['request']->getPresenterName() . (isset($params['action']) ? ':' . $params['action'] : '')) . '</th>' . | |
| 119 | - '<th>' . $h($snapshot['locale']) . '</th></tr>'; | |
| 117 | + $s .= '<tr><th width="10px"> </th>'. | |
| 118 | + '<th>'.$h($snapshot['request']->getPresenterName().(isset($params['action']) ? ':'.$params['action'] : '')).'</th>'. | |
| 119 | + '<th>'.$h($snapshot['locale']).'</th></tr>'; | |
| 120 | 120 | |
| 121 | 121 | $l = 1; | 
| 122 | 122 | /** @var mixed[][] $snapshot */ | 
| 123 | 123 |  				foreach ($snapshot['resolvers'] as $name => $resolvedLocale) { | 
| 124 | - $s .= '<tr><td>' . ($l++) . '.</td><td>' . $h($name) . '</td><td>' . $h($resolvedLocale) . '</td></tr>'; | |
| 124 | + $s .= '<tr><td>'.($l++).'.</td><td>'.$h($name).'</td><td>'.$h($resolvedLocale).'</td></tr>'; | |
| 125 | 125 | } | 
| 126 | 126 | |
| 127 | - $panel[] = '<table style="width:100%">' . $s . '</table>'; | |
| 127 | + $panel[] = '<table style="width:100%">'.$s.'</table>'; | |
| 128 | 128 | } | 
| 129 | 129 | } | 
| 130 | 130 | |
| @@ -142,14 +142,13 @@ discard block | ||
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | $panel[] = '<h2>Ignored resources</h2>'; | 
| 145 | -			$panel[] = '<p>Whitelist config: ' . implode(', ', array_map($h, $this->localeWhitelist)) . '</p>'; | |
| 145 | +			$panel[] = '<p>Whitelist config: '.implode(', ', array_map($h, $this->localeWhitelist)).'</p>'; | |
| 146 | 146 | $panel[] = $this->renderResources($this->ignoredResources); | 
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | - return empty($panel) ? '' : | |
| 150 | - '<h1>Missing translations: ' . count(array_unique($this->untranslated, SORT_REGULAR)) . | |
| 151 | - ', Resources: ' . count(Arrays::flatten($this->resources)) . '</h1>' . | |
| 152 | - '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . | |
| 149 | + return empty($panel) ? '' : '<h1>Missing translations: '.count(array_unique($this->untranslated, SORT_REGULAR)). | |
| 150 | + ', Resources: '.count(Arrays::flatten($this->resources)).'</h1>'. | |
| 151 | + '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">'.implode($panel).'</div>'. | |
| 153 | 152 | '<style> | 
| 154 | 153 | #nette-debug .kdyby-TranslationPanel h2, | 
| 155 | 154 |  				#tracy-debug .kdyby-TranslationPanel h2 {font-size: 23px;} | 
| @@ -167,19 +166,19 @@ discard block | ||
| 167 | 166 | $s .= '<tr><td>'; | 
| 168 | 167 | |
| 169 | 168 |  			if ($message instanceof \Exception || $message instanceof \Throwable) { | 
| 170 | - $s .= '<span style="color:red">' . $h($message->getMessage()) . '</span>'; | |
| 169 | + $s .= '<span style="color:red">'.$h($message->getMessage()).'</span>'; | |
| 171 | 170 | |
| 172 | 171 |  			} elseif ($message instanceof Html) { | 
| 173 | -				$s .= '<span style="color:red">Nette\Utils\Html(' . $h((string) $message) . ')</span>'; | |
| 172 | +				$s .= '<span style="color:red">Nette\Utils\Html('.$h((string) $message).')</span>'; | |
| 174 | 173 | |
| 175 | 174 |  			} else { | 
| 176 | 175 | $s .= $h($message); | 
| 177 | 176 | } | 
| 178 | 177 | |
| 179 | - $s .= '</td><td>' . $h($untranslated['domain']) . '</td></tr>'; | |
| 178 | + $s .= '</td><td>'.$h($untranslated['domain']).'</td></tr>'; | |
| 180 | 179 | } | 
| 181 | 180 | |
| 182 | - return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>' . $s . '</table>'; | |
| 181 | + return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>'.$s.'</table>'; | |
| 183 | 182 | } | 
| 184 | 183 | |
| 185 | 184 | private function renderResources($resourcesMap) | 
| @@ -191,25 +190,25 @@ discard block | ||
| 191 | 190 |  		foreach ($resourcesMap as $locale => $resources) { | 
| 192 | 191 |  			foreach ($resources as $resourcePath => $domain) { | 
| 193 | 192 | $s .= '<tr>'; | 
| 194 | - $s .= '<td>' . $h($locale) . '</td>'; | |
| 195 | - $s .= '<td>' . $h($domain) . '</td>'; | |
| 193 | + $s .= '<td>'.$h($locale).'</td>'; | |
| 194 | + $s .= '<td>'.$h($domain).'</td>'; | |
| 196 | 195 | |
| 197 | - $relativePath = str_replace(rtrim($this->rootDir, '/') . '/', '', $resourcePath); | |
| 196 | + $relativePath = str_replace(rtrim($this->rootDir, '/').'/', '', $resourcePath); | |
| 198 | 197 |  				if (Strings::startsWith($relativePath, 'vendor/')) { | 
| 199 | 198 |  					$parts = explode('/', $relativePath, 4); | 
| 200 | 199 | $left = array_pop($parts); | 
| 201 | -					$relativePath = $h(implode('/', $parts) . '/.../') . '<b>' . $h(basename($left)) . '</b>'; | |
| 200 | +					$relativePath = $h(implode('/', $parts).'/.../').'<b>'.$h(basename($left)).'</b>'; | |
| 202 | 201 | |
| 203 | 202 |  				} else { | 
| 204 | - $relativePath = $h(dirname($relativePath)) . '/<b>' . $h(basename($relativePath)) . '</b>'; | |
| 203 | + $relativePath = $h(dirname($relativePath)).'/<b>'.$h(basename($relativePath)).'</b>'; | |
| 205 | 204 | } | 
| 206 | 205 | |
| 207 | - $s .= '<td>' . self::editorLink($resourcePath, 1, $relativePath) . '</td>'; | |
| 206 | + $s .= '<td>'.self::editorLink($resourcePath, 1, $relativePath).'</td>'; | |
| 208 | 207 | $s .= '</tr>'; | 
| 209 | 208 | } | 
| 210 | 209 | } | 
| 211 | 210 | |
| 212 | - return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>' . $s . '</table>'; | |
| 211 | + return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>'.$s.'</table>'; | |
| 213 | 212 | } | 
| 214 | 213 | |
| 215 | 214 | /** | 
| @@ -245,7 +244,7 @@ discard block | ||
| 245 | 244 | public function addResource($format, $resource, $locale, $domain) | 
| 246 | 245 |  	{ | 
| 247 | 246 |  		if (is_array($resource)) { | 
| 248 | - $resource = 'array ' . md5(serialize($resource)); | |
| 247 | + $resource = 'array '.md5(serialize($resource)); | |
| 249 | 248 | } | 
| 250 | 249 | |
| 251 | 250 | $this->resources[$locale][$resource] = $domain; | 
| @@ -265,7 +264,7 @@ discard block | ||
| 265 | 264 | public function addIgnoredResource($format, $resource, $locale, $domain) | 
| 266 | 265 |  	{ | 
| 267 | 266 |  		if (is_array($resource)) { | 
| 268 | - $resource = 'array ' . md5(serialize($resource)); | |
| 267 | + $resource = 'array '.md5(serialize($resource)); | |
| 269 | 268 | } | 
| 270 | 269 | |
| 271 | 270 | $this->ignoredResources[$locale][$resource] = $domain; | 
| @@ -323,14 +322,14 @@ discard block | ||
| 323 | 322 | return NULL; | 
| 324 | 323 | } | 
| 325 | 324 | |
| 326 | - $method = YamlFileLoader::class . '::load'; | |
| 325 | + $method = YamlFileLoader::class.'::load'; | |
| 327 | 326 | $call = Helpers::findTrace($e->getPrevious()->getTrace(), $method); | 
| 328 | 327 |  		if ($call !== NULL) { | 
| 329 | 328 | return [ | 
| 330 | 329 | 'tab' => 'YAML dictionary', | 
| 331 | - 'panel' => '<p><b>File:</b> ' . self::editorLink($call['args'][0], $previous->getParsedLine()) . '</p>' | |
| 330 | + 'panel' => '<p><b>File:</b> '.self::editorLink($call['args'][0], $previous->getParsedLine()).'</p>' | |
| 332 | 331 | . ($previous->getParsedLine() ? BlueScreen::highlightFile($call['args'][0], $previous->getParsedLine()) : '') | 
| 333 | - . '<p>' . $previous->getMessage() . ' </p>', | |
| 332 | + . '<p>'.$previous->getMessage().' </p>', | |
| 334 | 333 | ]; | 
| 335 | 334 | } | 
| 336 | 335 | } |