@@ -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 | } |
@@ -136,7 +136,7 @@ discard block |
||
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 |
@@ -197,6 +197,8 @@ discard block |
||
197 | 197 | |
198 | 198 | /** |
199 | 199 | * {@inheritdoc} |
200 | + * @param string $domain |
|
201 | + * @param string $locale |
|
200 | 202 | */ |
201 | 203 | public function trans($message, array $parameters = [], $domain = NULL, $locale = NULL) |
202 | 204 | { |
@@ -224,6 +226,8 @@ discard block |
||
224 | 226 | |
225 | 227 | /** |
226 | 228 | * {@inheritdoc} |
229 | + * @param string $domain |
|
230 | + * @param string $locale |
|
227 | 231 | */ |
228 | 232 | public function transChoice($message, $number, array $parameters = [], $domain = NULL, $locale = NULL) |
229 | 233 | { |
@@ -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 | } |
@@ -50,6 +50,9 @@ |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * {@inheritdoc} |
53 | + * @param string $format |
|
54 | + * @param string $resource |
|
55 | + * @param string $locale |
|
53 | 56 | */ |
54 | 57 | public function addResource($format, $resource, $locale, $domain = 'messages') |
55 | 58 | { |
@@ -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 |
@@ -53,8 +53,8 @@ |
||
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 |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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 |
||
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 | /** |
@@ -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 | } |