Completed
Push — master ( 55d2c9...b8f7d2 )
by Stefano
15s queued 11s
created
src/View/Helper/I18nHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * {@inheritDoc}
34 34
      */
35
-    public $helpers = ['Html', 'Url'];
35
+    public $helpers = [ 'Html', 'Url' ];
36 36
 
37 37
     /**
38 38
      * Translation data per object and lang (internal cache).
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
      * @param array $included The included translations data
160 160
      * @return string|null
161 161
      */
162
-    public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = []): ?string
162
+    public function field(array $object, string $attribute, ?string $lang = null, bool $defaultNull = false, array $included = [ ]): ?string
163 163
     {
164 164
         $defaultValue = null;
165 165
         if (!$defaultNull) {
166 166
             $defaultValue = Hash::get($object, sprintf('attributes.%s', $attribute), Hash::get($object, sprintf('%s', $attribute)));
167 167
         }
168
-        if (empty($included) && !empty($this->getView()->viewVars['included'])) {
169
-            $included = $this->getView()->viewVars['included'];
168
+        if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) {
169
+            $included = $this->getView()->viewVars[ 'included' ];
170 170
         }
171 171
         if (empty($lang)) {
172 172
             $lang = Configure::read('I18n.lang', '');
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
      * @param array $included The included translations data)
189 189
      * @return bool
190 190
      */
191
-    public function exists(array $object, string $attribute, ?string $lang = null, array &$included = []): bool
191
+    public function exists(array $object, string $attribute, ?string $lang = null, array &$included = [ ]): bool
192 192
     {
193
-        if (empty($included) && !empty($this->getView()->viewVars['included'])) {
194
-            $included = $this->getView()->viewVars['included'];
193
+        if (empty($included) && !empty($this->getView()->viewVars[ 'included' ])) {
194
+            $included = $this->getView()->viewVars[ 'included' ];
195 195
         }
196 196
         if (empty($lang)) {
197 197
             $lang = Configure::read('I18n.lang', '');
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
      */
230 230
     private function getTranslatedField(array $object, string $attribute, string $lang, array &$included): ?string
231 231
     {
232
-        if (empty($object['id'])) {
232
+        if (empty($object[ 'id' ])) {
233 233
             return null;
234 234
         }
235 235
 
236
-        $id = $object['id'];
236
+        $id = $object[ 'id' ];
237 237
 
238 238
         if ($this->translation === null) {
239 239
             $translations = Hash::combine($included, '{n}.id', '{n}.attributes', '{n}.type');
Please login to merge, or discard this patch.
src/Core/I18nTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function getLocales(): array
45 45
     {
46
-        return (array)Configure::read('I18n.locales', []);
46
+        return (array)Configure::read('I18n.locales', [ ]);
47 47
     }
48 48
 
49 49
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getLanguages(): array
57 57
     {
58
-        return (array)Configure::read('I18n.languages', []);
58
+        return (array)Configure::read('I18n.languages', [ ]);
59 59
     }
60 60
 
61 61
     /**
Please login to merge, or discard this patch.
src/Shell/GettextShell.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @var array
63 63
      */
64
-    protected $poResult = [];
64
+    protected $poResult = [ ];
65 65
 
66 66
     /**
67 67
      * The template paths
68 68
      *
69 69
      * @var array
70 70
      */
71
-    protected $templatePaths = [];
71
+    protected $templatePaths = [ ];
72 72
 
73 73
     /**
74 74
      * The locale path
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function update(): void
93 93
     {
94
-        $resCmd = [];
94
+        $resCmd = [ ];
95 95
         exec('which msgmerge 2>&1', $resCmd);
96
-        if (empty($resCmd[0])) {
96
+        if (empty($resCmd[ 0 ])) {
97 97
             $this->out('ERROR: msgmerge not available. Please install gettext utilities.');
98 98
 
99 99
             return;
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
     private function setupPaths(): void
129 129
     {
130 130
         $basePath = getcwd();
131
-        if (isset($this->params['app'])) {
132
-            $f = new Folder($this->params['app']);
131
+        if (isset($this->params[ 'app' ])) {
132
+            $f = new Folder($this->params[ 'app' ]);
133 133
             $basePath = $f->path;
134
-        } elseif (isset($this->params['plugin'])) {
135
-            $startPath = ($this->params['startPath']) ? $this->params['startPath'] : getcwd();
136
-            $f = new Folder(sprintf('%s/plugins/%s', $startPath, $this->params['plugin']));
134
+        } elseif (isset($this->params[ 'plugin' ])) {
135
+            $startPath = ($this->params[ 'startPath' ]) ? $this->params[ 'startPath' ] : getcwd();
136
+            $f = new Folder(sprintf('%s/plugins/%s', $startPath, $this->params[ 'plugin' ]));
137 137
             $basePath = $f->path;
138
-            $this->poName = $this->params['plugin'] . ".po";
138
+            $this->poName = $this->params[ 'plugin' ] . ".po";
139 139
         }
140 140
 
141 141
         $this->templatePaths = [
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
         $potFilename = sprintf('%s/master.pot', $this->localePath);
177 177
         $folder = new Folder($this->localePath);
178 178
         $ls = $folder->read();
179
-        foreach ($ls[0] as $loc) {
180
-            if ($loc[0] != '.') { // only "regular" dirs...
179
+        foreach ($ls[ 0 ] as $loc) {
180
+            if ($loc[ 0 ] != '.') { // only "regular" dirs...
181 181
                 $this->out(sprintf('Language: %s', $loc));
182 182
                 $poFile = sprintf('%s/%s/%s', $this->localePath, $loc, $this->poName);
183 183
                 if (!file_exists($poFile)) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                 'Content-Type' => 'text/plain; charset=utf-8',
229 229
             ],
230 230
         ];
231
-        foreach ($contents[$type] as $k => $v) {
231
+        foreach ($contents[ $type ] as $k => $v) {
232 232
             $result .= sprintf('"%s: %s \n"', $k, $v) . "\n";
233 233
         }
234 234
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                 $numItems++;
251 251
             }
252 252
             if (strpos($l, 'msgstr ""') === 0) {
253
-                if (!isset($lines[$k + 1])) {
253
+                if (!isset($lines[ $k + 1 ])) {
254 254
                     $numNotTranslated++;
255
-                } elseif (strpos($lines[$k + 1], '"') !== 0) {
255
+                } elseif (strpos($lines[ $k + 1 ], '"') !== 0) {
256 256
                     $numNotTranslated++;
257 257
                 }
258 258
             }
@@ -319,17 +319,17 @@  discard block
 block discarded – undo
319 319
         // looks for __("text to translate",true)
320 320
         // or __('text to translate',true), result in matches[1] or in matches[2]
321 321
         $rgxp = "/" . "__\s*{$p}\s*{$q2}" . "([^{$q2}]*)" . "{$q2}" . "|" . "__\s*{$p}\s*{$q1}" . "([^{$q1}]*)" . "{$q1}" . "/";
322
-        $matches = [];
322
+        $matches = [ ];
323 323
         preg_match_all($rgxp, $content, $matches);
324 324
 
325
-        $limit = count($matches[0]);
325
+        $limit = count($matches[ 0 ]);
326 326
         for ($i = 0; $i < $limit; $i++) {
327
-            $item = $this->fixString($matches[1][$i]);
327
+            $item = $this->fixString($matches[ 1 ][ $i ]);
328 328
             if (empty($item)) {
329
-                $item = $this->fixString($matches[2][$i]);
329
+                $item = $this->fixString($matches[ 2 ][ $i ]);
330 330
             }
331 331
             if (!in_array($item, $this->poResult)) {
332
-                $this->poResult[] = $item;
332
+                $this->poResult[ ] = $item;
333 333
             }
334 334
         }
335 335
     }
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
                 if (!is_dir($file)) {
350 350
                     $f = new File($file);
351 351
                     $info = $f->info();
352
-                    if (isset($info['extension'])) {
353
-                        $this->parseFile($file, $info['extension']);
352
+                    if (isset($info[ 'extension' ])) {
353
+                        $this->parseFile($file, $info[ 'extension' ]);
354 354
                     }
355 355
                 }
356 356
             }
Please login to merge, or discard this patch.