Completed
Branch master (e11b09)
by Jakub
07:16
created
src/Loaders/FileLoader.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
   }
55 55
   
56 56
   function setLang(string $lang) {
57
-    if(method_exists($this->resolver, "setLang")) {
57
+    if (method_exists($this->resolver, "setLang")) {
58 58
       $this->resolver->setLang($lang);
59 59
     }
60 60
   }
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
    * @throws InvalidFolderException
80 80
    */
81 81
   function setFolders(array $folders) {
82
-    foreach($folders as $folder) {
83
-      if(!is_dir($folder)) {
82
+    foreach ($folders as $folder) {
83
+      if (!is_dir($folder)) {
84 84
         throw new InvalidFolderException("Folder $folder does not exist.");
85 85
       }
86 86
       $this->folders[] = $folder;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
   }
89 89
   
90 90
   protected function addResource(string $filename, string $domain): void {
91
-    if(!isset($this->resources[$domain]) OR !in_array($filename, $this->resources[$domain])) {
91
+    if (!isset($this->resources[$domain]) OR !in_array($filename, $this->resources[$domain])) {
92 92
       $this->resources[$domain][] = $filename;
93 93
     }
94 94
   }
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
     $files = Finder::findFiles($defaultFilename)
114 114
       ->from($this->folders);
115 115
     /** @var \SplFileInfo $file */
116
-    foreach($files as $file) {
116
+    foreach ($files as $file) {
117 117
       $default = $this->parseFile($file->getPathname());
118 118
       $this->addResource($file->getPathname(), $name);
119 119
       $lang = [];
120 120
       $filename = "$name.$this->lang.$extension";
121 121
       $filename = str_replace($defaultFilename, $filename, $file->getPathname());
122
-      if($this->lang != $defaultLang AND is_file($filename)) {
122
+      if ($this->lang != $defaultLang AND is_file($filename)) {
123 123
         $lang = $this->parseFile($filename);
124 124
         $this->addResource($filename, $name);
125 125
       }
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
    * @throws FolderNotSetException
135 135
    */
136 136
   protected function loadTexts(): void {
137
-    if($this->lang === $this->loadedLang) {
137
+    if ($this->lang === $this->loadedLang) {
138 138
       return;
139 139
     }
140
-    if(!count($this->folders)) {
140
+    if (!count($this->folders)) {
141 141
       throw new FolderNotSetException("Folder for translations was not set.");
142 142
     }
143 143
     $default = $this->defaultLang;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     $files = Finder::findFiles("*.$default.$extension")
147 147
       ->from($this->folders);
148 148
     /** @var \SplFileInfo $file */
149
-    foreach($files as $file) {
149
+    foreach ($files as $file) {
150 150
       $domain = $file->getBasename(".$default.$extension");
151 151
       $texts[$domain] = $this->loadDomain($domain);
152 152
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
    * @throws FolderNotSetException
174 174
    */
175 175
   function getAvailableLanguages(): array {
176
-    if(!count($this->folders)) {
176
+    if (!count($this->folders)) {
177 177
       throw new FolderNotSetException("Folder for translations was not set.");
178 178
     }
179 179
     $languages = [];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
     $files = Finder::findFiles($this->getLanguageFilenameMask())
182 182
       ->from($this->folders);
183 183
     /** @var \SplFileInfo $file */
184
-    foreach($files as $file) {
184
+    foreach ($files as $file) {
185 185
       $filename = $file->getBasename(".$extension");
186 186
       $lang = Strings::after($filename, ".");
187
-      if(!in_array($lang, $languages)) {
187
+      if (!in_array($lang, $languages)) {
188 188
         $languages[] = $lang;
189 189
       }
190 190
     }
Please login to merge, or discard this patch.
src/Loaders/MessagesCatalogue.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
   }
19 19
   
20 20
   protected function loadTexts(): void {
21
-    if(!count($this->folders)) {
21
+    if (!count($this->folders)) {
22 22
       throw new FolderNotSetException("Folder for translations was not set.");
23 23
     }
24 24
     $this->resources = $texts = [];
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
     $files = Finder::findFiles($filename)
27 27
       ->from($this->folders);
28 28
     /** @var \SplFileInfo $file */
29
-    foreach($files as $file) {
29
+    foreach ($files as $file) {
30 30
       $texts = array_merge($texts, $this->parseFile($file->getPathname()));
31
-      if(isset($texts["__resources"])) {
31
+      if (isset($texts["__resources"])) {
32 32
         $this->resources = array_merge($this->resources, $texts["__resources"]);
33 33
         unset($texts["__resources"]);
34 34
       } else {
35 35
         $domains = array_keys($texts);
36
-        foreach($domains as $domain) {
36
+        foreach ($domains as $domain) {
37 37
           $this->addResource($file->getPathname(), $domain);
38 38
         }
39 39
       }
Please login to merge, or discard this patch.
src/Loaders/IniLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
Please login to merge, or discard this patch.
src/Loaders/ILoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
Please login to merge, or discard this patch.
src/Loaders/JsonLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
Please login to merge, or discard this patch.
src/Loaders/NeonLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Loaders;
5 5
 
Please login to merge, or discard this patch.