Completed
Push — master ( cc2202...ef90d5 )
by Jakub
03:48
created
src/Bridges/NetteApplication/ParamLocaleResolver.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
   
31 31
   public function onRequest(Application $application, Request $request): void {
32 32
     $locale = $request->getParameter($this->param);
33
-    if($request->method === Request::FORWARD AND is_null($locale)) {
33
+    if($request->method === Request::FORWARD and is_null($locale)) {
34 34
       return;
35 35
     }
36 36
     $this->request = $request;
Please login to merge, or discard this patch.
tests/Nexendrie/Translation/CustomMessageSelector.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
     $variants = explode("|", $message);
79 79
     foreach($variants as $variant) {
80 80
       $interval = Intervals::findInterval($variant);
81
-      if(is_string($interval) AND Intervals::isInInterval($count, $interval)) {
81
+      if(is_string($interval) and Intervals::isInInterval($count, $interval)) {
82 82
         return Strings::trim(Strings::after($variant, $interval));
83 83
       }
84 84
     }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
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",
Please login to merge, or discard this patch.
src/Resolvers/HeaderLocaleResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@
 block discarded – undo
48 48
     if(is_null($header)) {
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]) {
Please login to merge, or discard this patch.
src/Loaders/IniLoader.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
src/Loaders/JsonLoader.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
src/Loaders/FileLoader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 */
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     $languages = [];
199 199
     $extension = $this->extension;
200 200
     $mask = $this->getLanguageFilenameMask();
201
-    $mask = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK,], "*", $mask);
201
+    $mask = str_replace([static::DOMAIN_MASK, static::LANGUAGE_MASK, ], "*", $mask);
202 202
     $files = Finder::findFiles($mask)
203 203
       ->from($this->folders);
204 204
     /** @var \SplFileInfo $file */
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
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
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
   }
106 106
   
107 107
   protected function addResource(string $filename, string $domain): void {
108
-    if(!isset($this->resources[$domain]) OR !in_array($filename, $this->resources[$domain], true)) {
108
+    if(!isset($this->resources[$domain]) or !in_array($filename, $this->resources[$domain], true)) {
109 109
       $this->resources[$domain][] = $filename;
110 110
     }
111 111
   }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
       $lang = [];
137 137
       $filename = str_replace($defaultLang, $this->lang, $defaultFilename);
138 138
       $filename = str_replace($defaultFilename, $filename, $file->getPathname());
139
-      if($this->lang != $defaultLang AND is_file($filename)) {
139
+      if($this->lang != $defaultLang and is_file($filename)) {
140 140
         $lang = $this->parseFile($filename);
141 141
         $this->addResource($filename, $name);
142 142
       }
Please login to merge, or discard this patch.
src/Loaders/NeonLoader.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
src/MessageSelector.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 final class MessageSelector implements IMessageSelector {
15 15
   public function isMultiChoice(string $message): bool {
16
-    return is_string(Intervals::findInterval($message)) AND Strings::contains($message, "|");
16
+    return is_string(Intervals::findInterval($message)) and Strings::contains($message, "|");
17 17
   }
18 18
   
19 19
   public function choose(string $message, int $count): string {
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     $variants = explode("|", $message);
24 24
     foreach($variants as $variant) {
25 25
       $interval = Intervals::findInterval($variant);
26
-      if(is_string($interval) AND Intervals::isInInterval($count, $interval)) {
26
+      if(is_string($interval) and Intervals::isInInterval($count, $interval)) {
27 27
         return Strings::trim((string) Strings::after($variant, $interval));
28 28
       }
29 29
     }
Please login to merge, or discard this patch.