@@ -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 | |
@@ -61,8 +61,8 @@ |
||
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @param string|\Kdyby\Translation\Phrase $message |
|
| 65 | - * @param int|array|NULL $count |
|
| 64 | + * @param string $message |
|
| 65 | + * @param integer|null $count |
|
| 66 | 66 | * @param array|string|NULL $parameters |
| 67 | 67 | * @param string|NULL $domain |
| 68 | 68 | * @param string|NULL $locale |
@@ -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); |
@@ -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 | |
@@ -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 | { |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | public function translate(Translator $translator, $count = NULL, array $parameters = [], $domain = NULL, $locale = NULL) |
| 94 | 94 | { |
| 95 | 95 | if (!is_string($this->message)) { |
| 96 | - throw new InvalidStateException("Message is not a string, type " . gettype($this->message) . ' given.'); |
|
| 96 | + throw new InvalidStateException("Message is not a string, type ".gettype($this->message).' given.'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $count = ($count !== NULL) ? (int) $count : $this->count; |
@@ -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 | { |