Completed
Push — master ( fccf07...03890a )
by Filip
04:57
created
src/TranslationLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,8 +95,8 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/LocaleResolver/AcceptHeaderResolver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Translator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 	 * Translates the given string.
137 137
 	 *
138 138
 	 * @param string|\Kdyby\Translation\Phrase|mixed $message The message id
139
-	 * @param int|array|NULL $count The number to use to find the indice of the message
139
+	 * @param integer|null $count The number to use to find the indice of the message
140 140
 	 * @param string|array|NULL $parameters An array of parameters for the message
141 141
 	 * @param string|NULL $domain The domain for the message
142 142
 	 * @param string|NULL $locale The locale
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Extractors/LatteExtractor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/LocaleResolver/SessionResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Diagnostics/Panel.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	}
226 226
 
227 227
 	/**
228
-	 * @param \Exception|\Throwable $e
228
+	 * @param \Exception $e
229 229
 	 * @param string|NULL $domain
230 230
 	 */
231 231
 	public function choiceError($e, $domain)
@@ -330,6 +330,8 @@  discard block
 block discarded – undo
330 330
 	/**
331 331
 	 * Returns link to editor.
332 332
 	 *
333
+	 * @param integer $line
334
+	 * @param string $text
333 335
 	 * @return \Nette\Utils\Html|string
334 336
 	 */
335 337
 	private static function editorLink($file, $line, $text = NULL)
Please login to merge, or discard this patch.
Spacing   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function getTab()
84 84
 	{
85 85
 		return '<span title="Translation"><img width="16px" height="16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90DExAuL9uIsPUAAAQ2SURBVFjD7Ze9bxxVFMV/583skjgOIXEaKCNFAgmQ+ExS8qEUC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WffXiPP+/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
 block discarded – undo
114 114
 
115 115
 				/** @var \Nette\Application\Request[] $snapshot */
116 116
 				$params = $snapshot['request']->getParameters();
117
-				$s .= '<tr><th width="10px">&nbsp;</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">&nbsp;</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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
@@ -315,14 +314,14 @@  discard block
 block discarded – undo
315 314
 			return NULL;
316 315
 		}
317 316
 
318
-		$method = YamlFileLoader::class . '::load';
317
+		$method = YamlFileLoader::class.'::load';
319 318
 		$call = Helpers::findTrace($e->getPrevious()->getTrace(), $method);
320 319
 		if ($call !== NULL) {
321 320
 			return [
322 321
 				'tab' => 'YAML dictionary',
323
-				'panel' => '<p><b>File:</b> ' . self::editorLink($call['args'][0], $previous->getParsedLine()) . '</p>'
322
+				'panel' => '<p><b>File:</b> '.self::editorLink($call['args'][0], $previous->getParsedLine()).'</p>'
324 323
 					. ($previous->getParsedLine() ? BlueScreen::highlightFile($call['args'][0], $previous->getParsedLine()) : '')
325
-					. '<p>' . $previous->getMessage() . ' </p>',
324
+					. '<p>'.$previous->getMessage().' </p>',
326 325
 			];
327 326
 		}
328 327
 	}
Please login to merge, or discard this patch.
src/IResourceLoader.php 1 patch
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -21,6 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param string $format The format of the loader
23 23
 	 * @param \Symfony\Component\Translation\Loader\LoaderInterface $loader
24
+	 * @return void
24 25
 	 */
25 26
 	public function addLoader($format, LoaderInterface $loader);
26 27
 
@@ -35,6 +36,7 @@  discard block
 block discarded – undo
35 36
 	 * @param string $domain
36 37
 	 * @param \Symfony\Component\Translation\MessageCatalogue $catalogue
37 38
 	 * @throws \Kdyby\Translation\LoaderNotFoundException
39
+	 * @return void
38 40
 	 */
39 41
 	public function loadResource($format, $resource, $domain, MessageCatalogue $catalogue);
40 42
 
Please login to merge, or discard this patch.
src/PrefixedTranslator.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	/**
56
-	 * @param string|\Kdyby\Translation\Phrase $message
57
-	 * @param int|array|NULL $count
56
+	 * @param string $message
57
+	 * @param integer|null $count
58 58
 	 * @param array|string|NULL $parameters
59 59
 	 * @param string|NULL $domain
60 60
 	 * @param string|NULL $locale
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function translate($message, $count = NULL, $parameters = [], $domain = NULL, $locale = NULL)
64 64
 	{
65 65
 		$translationString = ($message instanceof Phrase ? $message->message : $message);
66
-		$prefix = $this->prefix . '.';
66
+		$prefix = $this->prefix.'.';
67 67
 
68 68
 		if (Strings::startsWith($message, '//')) {
69 69
 			$prefix = NULL;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		}
72 72
 
73 73
 		if ($message instanceof Phrase) {
74
-			return $this->translator->translate(new Phrase($prefix . $translationString, $message->count, $message->parameters, $message->domain, $message->locale));
74
+			return $this->translator->translate(new Phrase($prefix.$translationString, $message->count, $message->parameters, $message->domain, $message->locale));
75 75
 		}
76 76
 
77 77
 		if (is_array($count)) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			$count = NULL;
82 82
 		}
83 83
 
84
-		return $this->translator->translate($prefix . $translationString, $count, (array) $parameters, $domain, $locale);
84
+		return $this->translator->translate($prefix.$translationString, $count, (array) $parameters, $domain, $locale);
85 85
 	}
86 86
 
87 87
 	/**
Please login to merge, or discard this patch.
src/Latte/TranslateMacros.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.