@@ -2,7 +2,7 @@ |
||
| 2 | 2 | declare(strict_types=1); |
| 3 | 3 | |
| 4 | 4 | require __DIR__ . "/../vendor/autoload.php"; |
| 5 | -Testbench\Bootstrap::setup(__DIR__ . '/_temp', function (\Nette\Configurator $configurator) { |
|
| 5 | +Testbench\Bootstrap::setup(__DIR__ . '/_temp', function(\Nette\Configurator $configurator) { |
|
| 6 | 6 | $configurator->addParameters([ |
| 7 | 7 | "appDir" => __DIR__, |
| 8 | 8 | "tempDir" => __DIR__ . "/_temp", |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | protected function parseFile(string $filename): array { |
| 19 | 19 | $result = parse_ini_file($filename, true); |
| 20 | 20 | if($result === false) { |
| 21 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 21 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 22 | 22 | } |
| 23 | 23 | return $result; |
| 24 | 24 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | protected function parseFile(string $filename): array { |
| 22 | 22 | $content = file_get_contents($filename); |
| 23 | 23 | if($content === false) { |
| 24 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 24 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 25 | 25 | } |
| 26 | 26 | return Json::decode($content, Json::FORCE_ARRAY); |
| 27 | 27 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | protected function parseFile(string $filename): array { |
| 21 | 21 | $content = file_get_contents($filename); |
| 22 | 22 | if($content === false) { |
| 23 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 23 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 24 | 24 | } |
| 25 | 25 | return Neon::decode($content); |
| 26 | 26 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | public function getConfigSchema(): \Nette\Schema\Schema { |
| 86 | 86 | $params = $this->getContainerBuilder()->parameters; |
| 87 | 87 | return Expect::structure([ |
| 88 | - "localeResolver" => Expect::anyOf(Expect::string(), Expect::arrayOf("string"))->default(["param", "session", "header",]), |
|
| 88 | + "localeResolver" => Expect::anyOf(Expect::string(), Expect::arrayOf("string"))->default(["param", "session", "header", ]), |
|
| 89 | 89 | "default" => Expect::string("en"), |
| 90 | 90 | "debugger" => Expect::bool(Helpers::expand("%debugMode%", $params)), |
| 91 | 91 | "loader" => Expect::structure([ |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | } |
| 160 | 160 | foreach($folders as $folder) { |
| 161 | 161 | if(!is_dir($folder)) { |
| 162 | - throw new InvalidFolderException("Folder $folder does not exist."); |
|
| 162 | + throw new InvalidFolderException("folder $folder does not exist."); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | return $folders; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $return = []; |
| 127 | 127 | $defaultLang = $this->defaultLang; |
| 128 | 128 | $defaultFilename = $this->getLanguageFilenameMask(); |
| 129 | - $defaultFilename = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK, ], [$name, $defaultLang,], $defaultFilename); |
|
| 129 | + $defaultFilename = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK, ], [$name, $defaultLang, ], $defaultFilename); |
|
| 130 | 130 | $files = Finder::findFiles($defaultFilename) |
| 131 | 131 | ->from($this->folders); |
| 132 | 132 | /** @var \SplFileInfo $file */ |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $default = $this->defaultLang; |
| 161 | 161 | $this->resources = $texts = []; |
| 162 | 162 | $mask = $this->getLanguageFilenameMask(); |
| 163 | - $mask = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK, ], ["*", $default,], $mask); |
|
| 163 | + $mask = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK, ], ["*", $default, ], $mask); |
|
| 164 | 164 | $files = Finder::findFiles($mask) |
| 165 | 165 | ->from($this->folders); |
| 166 | 166 | /** @var \SplFileInfo $file */ |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | public function setFolders(array $folders): void { |
| 98 | 98 | foreach($folders as $folder) { |
| 99 | 99 | if(!is_dir($folder)) { |
| 100 | - throw new InvalidFolderException("Folder $folder does not exist."); |
|
| 100 | + throw new InvalidFolderException("folder $folder does not exist."); |
|
| 101 | 101 | } |
| 102 | 102 | $this->folders[] = $folder; |
| 103 | 103 | } |
@@ -48,9 +48,9 @@ |
||
| 48 | 48 | if($header === null) { |
| 49 | 49 | return null; |
| 50 | 50 | } |
| 51 | - $s = strtolower($header); // case insensitive |
|
| 52 | - $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
| 53 | - rsort($langs); // first more specific |
|
| 51 | + $s = strtolower($header); // case insensitive |
|
| 52 | + $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
| 53 | + rsort($langs); // first more specific |
|
| 54 | 54 | $pattern = ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#'; |
| 55 | 55 | preg_match_all('#(' . implode('|', $langs) . $pattern, $s, $matches); |
| 56 | 56 | if(!$matches[0]) { |