Completed
Push — master ( bd25ed...8bde1c )
by Alberto
13s queued 12s
created
src/View/Helper/I18nHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * {@inheritDoc}
35 35
      */
36
-    public $helpers = ['Html', 'Url'];
36
+    public $helpers = [ 'Html', 'Url' ];
37 37
 
38 38
     /**
39 39
      * Translation data per object and lang (internal cache).
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         string $attribute,
166 166
         ?string $lang = null,
167 167
         bool $defaultNull = false,
168
-        array $included = []
168
+        array $included = [ ]
169 169
     ): ?string {
170 170
         $defaultValue = null;
171 171
         if (!$defaultNull) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @param array $included The included translations data)
199 199
      * @return bool
200 200
      */
201
-    public function exists(array $object, string $attribute, ?string $lang = null, array &$included = []): bool
201
+    public function exists(array $object, string $attribute, ?string $lang = null, array &$included = [ ]): bool
202 202
     {
203 203
         if (empty($included) && !empty($this->_View->get('included'))) {
204 204
             $included = $this->_View->get('included');
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
      */
240 240
     private function getTranslatedField(array $object, string $attribute, string $lang, array &$included): ?string
241 241
     {
242
-        if (empty($object['id'])) {
242
+        if (empty($object[ 'id' ])) {
243 243
             return null;
244 244
         }
245 245
 
246
-        $id = $object['id'];
246
+        $id = $object[ 'id' ];
247 247
 
248 248
         if ($this->translation === null) {
249 249
             $translations = Hash::combine($included, '{n}.id', '{n}.attributes', '{n}.type');
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      * @param array $options Array of options.
268 268
      * @return string Full I18n URL.
269 269
      */
270
-    public function buildUrl($path, $options = []): string
270
+    public function buildUrl($path, $options = [ ]): string
271 271
     {
272 272
         if (is_string($path) && !$this->isI18nPath($path)) {
273 273
             $path = sprintf('/%s%s', $this->getLang(), $path);
Please login to merge, or discard this patch.
src/Routing/Route/I18nRoute.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * {@inheritDoc}
31 31
      */
32
-    public function __construct($template, $defaults = [], array $options = [])
32
+    public function __construct($template, $defaults = [ ], array $options = [ ])
33 33
     {
34 34
         parent::__construct($this->buildTemplate($template), $defaults, $options);
35 35
 
36
-        if (empty($options['lang'])) {
37
-            $this->setPatterns(['lang' => implode('|', array_keys($this->getLanguages()))]);
36
+        if (empty($options[ 'lang' ])) {
37
+            $this->setPatterns([ 'lang' => implode('|', array_keys($this->getLanguages())) ]);
38 38
         }
39 39
     }
40 40
 
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * {@inheritDoc}
64 64
      */
65
-    public function match(array $url, array $context = []): ?string
65
+    public function match(array $url, array $context = [ ]): ?string
66 66
     {
67 67
         if (!array_key_exists('lang', $url)) {
68
-            $url['lang'] = $this->getLang();
68
+            $url[ 'lang' ] = $this->getLang();
69 69
         }
70 70
 
71 71
         return parent::match($url, $context);
Please login to merge, or discard this patch.
src/Shell/GettextShell.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @var array
67 67
      */
68
-    protected $poResult = [];
68
+    protected $poResult = [ ];
69 69
 
70 70
     /**
71 71
      * The template paths
72 72
      *
73 73
      * @var array
74 74
      */
75
-    protected $templatePaths = [];
75
+    protected $templatePaths = [ ];
76 76
 
77 77
     /**
78 78
      * The locale path
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function update(): void
97 97
     {
98
-        $resCmd = [];
98
+        $resCmd = [ ];
99 99
         exec('which msgmerge 2>&1', $resCmd);
100
-        if (empty($resCmd[0])) {
100
+        if (empty($resCmd[ 0 ])) {
101 101
             $this->out('ERROR: msgmerge not available. Please install gettext utilities.');
102 102
 
103 103
             return;
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
     private function setupPaths(): void
133 133
     {
134 134
         $basePath = getcwd();
135
-        if (isset($this->params['app'])) {
136
-            $f = new Folder($this->params['app']);
135
+        if (isset($this->params[ 'app' ])) {
136
+            $f = new Folder($this->params[ 'app' ]);
137 137
             $basePath = $f->path;
138
-        } elseif (isset($this->params['plugin'])) {
139
-            $startPath = $this->params['startPath'] ? $this->params['startPath'] : getcwd();
140
-            $f = new Folder(sprintf('%s/plugins/%s', $startPath, $this->params['plugin']));
138
+        } elseif (isset($this->params[ 'plugin' ])) {
139
+            $startPath = $this->params[ 'startPath' ] ? $this->params[ 'startPath' ] : getcwd();
140
+            $f = new Folder(sprintf('%s/plugins/%s', $startPath, $this->params[ 'plugin' ]));
141 141
             $basePath = $f->path;
142
-            $this->poName = $this->params['plugin'] . ".po";
142
+            $this->poName = $this->params[ 'plugin' ] . ".po";
143 143
         }
144 144
 
145 145
         $this->templatePaths = [
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     {
180 180
         $header = $this->header('po');
181 181
         $potFilename = sprintf('%s/master.pot', $this->localePath);
182
-        $locales = array_keys((array)Configure::read('I18n.locales', []));
182
+        $locales = array_keys((array)Configure::read('I18n.locales', [ ]));
183 183
         foreach ($locales as $loc) {
184 184
             $potDir = $this->localePath . DS . $loc;
185 185
             if (!file_exists($potDir)) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                 'Content-Type' => 'text/plain; charset=utf-8',
235 235
             ],
236 236
         ];
237
-        foreach ($contents[$type] as $k => $v) {
237
+        foreach ($contents[ $type ] as $k => $v) {
238 238
             $result .= sprintf('"%s: %s \n"', $k, $v) . "\n";
239 239
         }
240 240
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
                 $numItems++;
257 257
             }
258 258
             if (strpos($l, 'msgstr ""') === 0) {
259
-                if (!isset($lines[$k + 1])) {
259
+                if (!isset($lines[ $k + 1 ])) {
260 260
                     $numNotTranslated++;
261
-                } elseif (strpos($lines[$k + 1], '"') !== 0) {
261
+                } elseif (strpos($lines[ $k + 1 ], '"') !== 0) {
262 262
                     $numNotTranslated++;
263 263
                 }
264 264
             }
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
         // or __('text to translate',true), result in matches[1] or in matches[2]
327 327
         $rgxp = "/" . "__\s*{$p}\s*{$q2}" . "([^{$q2}]*)" . "{$q2}" .
328 328
             "|" . "__\s*{$p}\s*{$q1}" . "([^{$q1}]*)" . "{$q1}" . "/";
329
-        $matches = [];
329
+        $matches = [ ];
330 330
         preg_match_all($rgxp, $content, $matches);
331 331
 
332
-        $limit = count($matches[0]);
332
+        $limit = count($matches[ 0 ]);
333 333
         for ($i = 0; $i < $limit; $i++) {
334
-            $item = $this->fixString($matches[1][$i]);
334
+            $item = $this->fixString($matches[ 1 ][ $i ]);
335 335
             if (empty($item)) {
336
-                $item = $this->fixString($matches[2][$i]);
336
+                $item = $this->fixString($matches[ 2 ][ $i ]);
337 337
             }
338 338
             if (!in_array($item, $this->poResult)) {
339
-                $this->poResult[] = $item;
339
+                $this->poResult[ ] = $item;
340 340
             }
341 341
         }
342 342
     }
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
                 if (!is_dir($file)) {
357 357
                     $f = new File($file);
358 358
                     $info = $f->info();
359
-                    if (isset($info['extension'])) {
360
-                        $this->parseFile($file, $info['extension']);
359
+                    if (isset($info[ 'extension' ])) {
360
+                        $this->parseFile($file, $info[ 'extension' ]);
361 361
                     }
362 362
                 }
363 363
             }
Please login to merge, or discard this patch.