Test Failed
Branch master (6c9066)
by Björn
01:44
created
module/Application/src/Application/Model/DbStructUpdater.php 4 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
     var $config = array();//updater configuration
61 61
 
62 62
     /**
63
-    * Constructor
63
+     * Constructor
64 64
      *
65
-    * @access public
66
-    */
65
+     * @access public
66
+     */
67 67
     public function __construct()
68 68
     {
69 69
         $this->init();
70 70
     }
71 71
 
72 72
     /**
73
-    * Constructor
73
+     * Constructor
74 74
      *
75
-    * @access public
76
-    */
75
+     * @access public
76
+     */
77 77
     public function dbStructUpdater()
78 78
     {
79 79
         $this->init();
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
     }
97 97
 
98 98
     /**
99
-    * merges current updater config with the given one
99
+     * merges current updater config with the given one
100 100
      *
101
-    * @param assoc_array $config new configuration values
102
-    */
101
+     * @param assoc_array $config new configuration values
102
+     */
103 103
     public function setConfig($config=array())
104 104
     {
105 105
         if (is_array($config)) {
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     }
109 109
 
110 110
     /**
111
-    * Returns array of update SQL with default options, $source, $dest - database structures
111
+     * Returns array of update SQL with default options, $source, $dest - database structures
112 112
      *
113
-    * @access public
114
-    * @param  string $source   structure dump of database to update
115
-    * @param  string $dest     structure dump of the reference database
116
-    * @param  bool   $asString if true - result will be a string, otherwise - array
117
-    * @return array|string update sql statements - in array or string (separated with ';')
118
-    */
113
+     * @access public
114
+     * @param  string $source   structure dump of database to update
115
+     * @param  string $dest     structure dump of the reference database
116
+     * @param  bool   $asString if true - result will be a string, otherwise - array
117
+     * @return array|string update sql statements - in array or string (separated with ';')
118
+     */
119 119
     public function getUpdates($source, $dest, $asString=false)
120 120
     {
121 121
         $result = $asString?'':array();
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
     }
136 136
 
137 137
     /**
138
-    * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option
139
-    */
138
+     * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option
139
+     */
140 140
     public function filterDiffs($compRes)
141 141
     {
142 142
         $result = array();
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
     }
186 186
     
187 187
     /**
188
-    * Gets structured general info about the databases diff :
189
-    * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...))
190
-    */
188
+     * Gets structured general info about the databases diff :
189
+     * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...))
190
+     */
191 191
     public function getDiffInfo($compRes)
192 192
     {        
193 193
         if (!is_array($compRes)) {
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
     }
212 212
 
213 213
     /**
214
-    * Makes comparison of the given database structures, support some options
214
+     * Makes comparison of the given database structures, support some options
215 215
      *
216
-    * @access private
217
-    * @param  string $source and $dest are strings - database tables structures
218
-    * @return array
219
-    * - table (array)
220
-    *        - destOrphan (boolean)
221
-    *        - sourceOrphan (boolean)
222
-    *        - differs (array) OR (boolean) false if no diffs
223
-    *            - [0](array)
224
-    *                - source (string) structure definition line in the out-of-date table
225
-    *                - dest (string) structure definition line in the reference table
226
-    *            - [1](array) ...
227
-    */
216
+     * @access private
217
+     * @param  string $source and $dest are strings - database tables structures
218
+     * @return array
219
+     * - table (array)
220
+     *        - destOrphan (boolean)
221
+     *        - sourceOrphan (boolean)
222
+     *        - differs (array) OR (boolean) false if no diffs
223
+     *            - [0](array)
224
+     *                - source (string) structure definition line in the out-of-date table
225
+     *                - dest (string) structure definition line in the reference table
226
+     *            - [1](array) ...
227
+     */
228 228
     private function compare($source, $dest)
229 229
     {
230 230
         $this->sourceStruct = $source;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
     }
271 271
 
272 272
     /**
273
-    * Retrieves list of table names from the database structure dump
273
+     * Retrieves list of table names from the database structure dump
274 274
      *
275
-    * @access private
276
-    * @param  string $struct database structure listing
277
-    */
275
+     * @access private
276
+     * @param  string $struct database structure listing
277
+     */
278 278
     private function getTableList($struct)
279 279
     {
280 280
         $result = array();
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
     }
289 289
 
290 290
     /**
291
-    * Retrieves table structure definition from the database structure dump
291
+     * Retrieves table structure definition from the database structure dump
292 292
      *
293
-    * @access private
294
-    * @param  string $struct         database structure listing
295
-    * @param  string $tab            table name
296
-    * @param  bool   $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations
297
-    * @return string table structure definition
298
-    */
293
+     * @access private
294
+     * @param  string $struct         database structure listing
295
+     * @param  string $tab            table name
296
+     * @param  bool   $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations
297
+     * @return string table structure definition
298
+     */
299 299
     private function getTabSql($struct, $tab, $removeDatabase=true)
300 300
     {
301 301
         $result = '';
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
     }
324 324
     
325 325
     /**
326
-    * Splits table sql into indexed array
327
-    */
326
+     * Splits table sql into indexed array
327
+     */
328 328
     public function splitTabSql($sql)
329 329
     {
330 330
         $result = array();
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
     /**
368
-    * returns array of fields or keys definitions that differs in the given tables structure
368
+     * returns array of fields or keys definitions that differs in the given tables structure
369 369
      *
370
-    * @access private
371
-    * @param  sring $sourceSql table structure
372
-    * @param  sring $destSql   right table structure supports some $options
373
-    * supports some $options
374
-    * @return array
375
-    *     - [0]
376
-    *         - source (string) out-of-date table field definition
377
-    *         - dest (string) reference table field definition
378
-    *     - [1]...
379
-    */
370
+     * @access private
371
+     * @param  sring $sourceSql table structure
372
+     * @param  sring $destSql   right table structure supports some $options
373
+     * supports some $options
374
+     * @return array
375
+     *     - [0]
376
+     *         - source (string) out-of-date table field definition
377
+     *         - dest (string) reference table field definition
378
+     *     - [1]...
379
+     */
380 380
     private function compareSql($sourceSql, $destSql)//$sourceSql, $destSql
381 381
     {
382 382
         $result = array();        
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
     }
440 440
 
441 441
     /**
442
-    * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely
443
-    * defines field or key desribed
442
+     * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely
443
+     * defines field or key desribed
444 444
      *
445
-    * @access private
446
-    * @param  string $line field definition string
447
-    * @return array array with single key=>value pair as described in the description
448
-    * implements some options
449
-    */
445
+     * @access private
446
+     * @param  string $line field definition string
447
+     * @return array array with single key=>value pair as described in the description
448
+     * implements some options
449
+     */
450 450
     private function processLine($line)
451 451
     {
452 452
         $options = $this->config;
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
     }
485 485
 
486 486
     /**
487
-    * Takes an output of compare() method to generate the set of sql needed to update source table to make it
488
-    * look as a destination one
487
+     * Takes an output of compare() method to generate the set of sql needed to update source table to make it
488
+     * look as a destination one
489 489
      *
490
-    * @access private
491
-    * @param  array $diff compare() method output
492
-    * @return array list of sql statements
493
-    * supports query generation options
494
-    */
490
+     * @access private
491
+     * @param  array $diff compare() method output
492
+     * @return array list of sql statements
493
+     * supports query generation options
494
+     */
495 495
     private function getDiffSql($diff)//maybe add option to ommit or force 'IF NOT EXISTS', skip autoincrement
496 496
     {
497 497
         $options = $this->config;
@@ -548,14 +548,14 @@  discard block
 block discarded – undo
548 548
     }
549 549
 
550 550
     /**
551
-    * Compiles update sql
551
+     * Compiles update sql
552 552
      *
553
-    * @access private
554
-    * @param  string $action - 'drop', 'add' or 'modify'
555
-    * @param  string $tab    table name
556
-    * @param  string $sql    definition of the element to change
557
-    * @return string update sql
558
-    */
553
+     * @access private
554
+     * @param  string $action - 'drop', 'add' or 'modify'
555
+     * @param  string $tab    table name
556
+     * @param  string $sql    definition of the element to change
557
+     * @return string update sql
558
+     */
559 559
     private function getActionSql($action, $tab, $sql)
560 560
     {
561 561
         $result = 'ALTER TABLE `'.$tab.'` ';
@@ -621,14 +621,14 @@  discard block
 block discarded – undo
621 621
     }
622 622
 
623 623
     /**
624
-    * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or
625
-    * like "this ; ".
626
-    *
627
-    * Handles escaped \" and \'. Also handles sql comments.
628
-    * Actualy it is regex-based Finit State Machine (FSN)
629
-    *
630
-    * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts
631
-    */
624
+     * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or
625
+     * like "this ; ".
626
+     *
627
+     * Handles escaped \" and \'. Also handles sql comments.
628
+     * Actualy it is regex-based Finit State Machine (FSN)
629
+     *
630
+     * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts
631
+     */
632 632
     public function getDelimPos($string, $offset=0, $delim=';', $skipInBrackets=false)
633 633
     {
634 634
         $stack = array();
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
     }
702 702
     
703 703
     /**
704
-    * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from
705
-    * the end of the string
706
-    */
704
+     * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from
705
+     * the end of the string
706
+     */
707 707
     public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false)
708 708
     {
709 709
         $pos = $this->getDelimPos($string, $offset, $delim, $skipInBrackets);
Please login to merge, or discard this patch.
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -568,39 +568,39 @@
 block discarded – undo
568 568
             $fields = trim($m[3]);
569 569
             switch($action)
570 570
             {
571
-            case 'drop':
572
-                if ($type=='primary') {
573
-                    $result.= 'DROP PRIMARY KEY';
574
-                }
575
-                else
576
-                {
577
-                    $result.= 'DROP INDEX `'.$name.'`';
578
-                }
579
-                break;
580
-            case 'add':
581
-                if ($type=='primary') {
582
-                    $result.= 'ADD PRIMARY KEY '.$fields;
583
-                }
584
-                elseif ($type=='') {
585
-                    $result.= 'ADD INDEX `'.$name.'` '.$fields;
586
-                }
587
-                else
588
-                {
589
-                    $result .='ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
590
-                }
591
-                break;
592
-            case 'modify':
593
-                if ($type=='primary') {
594
-                    $result.='DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields;
595
-                }
596
-                elseif ($type=='') {
597
-                    $result.='DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields;
598
-                }
599
-                else
600
-                {
601
-                    $result.='DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
602
-                }
603
-                break;
571
+                case 'drop':
572
+                    if ($type=='primary') {
573
+                        $result.= 'DROP PRIMARY KEY';
574
+                    }
575
+                    else
576
+                    {
577
+                        $result.= 'DROP INDEX `'.$name.'`';
578
+                    }
579
+                    break;
580
+                case 'add':
581
+                    if ($type=='primary') {
582
+                        $result.= 'ADD PRIMARY KEY '.$fields;
583
+                    }
584
+                    elseif ($type=='') {
585
+                        $result.= 'ADD INDEX `'.$name.'` '.$fields;
586
+                    }
587
+                    else
588
+                    {
589
+                        $result .='ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
590
+                    }
591
+                    break;
592
+                case 'modify':
593
+                    if ($type=='primary') {
594
+                        $result.='DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields;
595
+                    }
596
+                    elseif ($type=='') {
597
+                        $result.='DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields;
598
+                    }
599
+                    else
600
+                    {
601
+                        $result.='DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
602
+                    }
603
+                    break;
604 604
 
605 605
             }
606 606
         }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 */
56 56
 class DbStructUpdater
57 57
 {
58
-    var $sourceStruct = '';//structure dump of the reference database
59
-    var $destStruct = '';//structure dump of database to update
60
-    var $config = array();//updater configuration
58
+    var $sourceStruct = ''; //structure dump of the reference database
59
+    var $destStruct = ''; //structure dump of database to update
60
+    var $config = array(); //updater configuration
61 61
 
62 62
     /**
63 63
     * Constructor
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
     * @param assoc_array $config new configuration values
102 102
     */
103
-    public function setConfig($config=array())
103
+    public function setConfig($config = array())
104 104
     {
105 105
         if (is_array($config)) {
106 106
             $this->config = array_merge($this->config, $config);
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     * @param  bool   $asString if true - result will be a string, otherwise - array
117 117
     * @return array|string update sql statements - in array or string (separated with ';')
118 118
     */
119
-    public function getUpdates($source, $dest, $asString=false)
119
+    public function getUpdates($source, $dest, $asString = false)
120 120
     {
121
-        $result = $asString?'':array();
121
+        $result = $asString ? '' : array();
122 122
         $compRes = $this->compare($source, $dest);
123 123
         if (empty($compRes)) {
124 124
             return $result;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         }
150 150
         $allowedActions = array('create', 'drop', 'add', 'remove', 'modify');
151 151
         $updateActions = array_intersect($updateActions, $allowedActions);
152
-        foreach($compRes as $table=>$info)
152
+        foreach ($compRes as $table=>$info)
153 153
         {
154 154
             if ($info['sourceOrphan']) {
155 155
                 if (in_array('create', $updateActions)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                     $result[$table] = $info;
162 162
                 }
163 163
             }
164
-            elseif($info['differs']) {
164
+            elseif ($info['differs']) {
165 165
                 $resultInfo = $info;
166 166
                 unset($resultInfo['differs']);
167 167
                 foreach ($info['differs'] as $diff)
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                     elseif (empty($diff['source']) && in_array('remove', $updateActions)) {
173 173
                         $resultInfo['differs'][] = $diff;
174 174
                     }
175
-                    elseif(in_array('modify', $updateActions)) {
175
+                    elseif (in_array('modify', $updateActions)) {
176 176
                         $resultInfo['differs'][] = $diff;
177 177
                     }
178 178
                 }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             return false;
195 195
         }
196 196
         $result = array('sourceOrphans'=>array(), 'destOrphans'=>array(), 'different'=>array());
197
-        foreach($compRes as $table=>$info)
197
+        foreach ($compRes as $table=>$info)
198 198
         {
199 199
             if ($info['sourceOrphan']) {
200 200
                 $result['sourceOrphans'][] = $table;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         foreach ($all as $tab)
243 243
         {
244 244
             $info = array('destOrphan'=>false, 'sourceOrphan'=>false, 'differs'=>false);
245
-            if(in_array($tab, $destOrphans)) {
245
+            if (in_array($tab, $destOrphans)) {
246 246
                 $info['destOrphan'] = true;
247 247
             }
248 248
             elseif (in_array($tab, $sourceOrphans)) {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $destSql = $this->getTabSql($this->destStruct, $tab, true);
254 254
                 $sourceSql = $this->getTabSql($this->sourceStruct, $tab, true);
255 255
                 $diffs = $this->compareSql($sourceSql, $destSql);                
256
-                if ($diffs===false) {
256
+                if ($diffs === false) {
257 257
                     trigger_error('[WARNING] error parsing definition of table "'.$tab.'" - skipped');
258 258
                     continue;
259 259
                 }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 {
262 262
                     $info['differs'] = $diffs;                    
263 263
                 }                
264
-                else { continue;//empty array
264
+                else { continue; //empty array
265 265
                 }         
266 266
             }
267 267
             $result[$tab] = $info;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     {
280 280
         $result = array();
281 281
         if (preg_match_all('/CREATE(?:\s*TEMPORARY)?\s*TABLE\s*(?:IF NOT EXISTS\s*)?(?:`?(\w+)`?\.)?`?(\w+)`?/i', $struct, $m)) {
282
-            foreach($m[2] as $match)//m[1] is a database name if any
282
+            foreach ($m[2] as $match)//m[1] is a database name if any
283 283
             {
284 284
                 $result[] = $match;
285 285
             }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
     * @param  bool   $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations
297 297
     * @return string table structure definition
298 298
     */
299
-    private function getTabSql($struct, $tab, $removeDatabase=true)
299
+    private function getTabSql($struct, $tab, $removeDatabase = true)
300 300
     {
301 301
         $result = '';
302 302
         /* create table should be single line in this case*/
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
             $tableDef = $m[0][0];
306 306
             $start = $m[0][1];
307 307
             $database = $m[2][0];
308
-            $offset = $start+strlen($m[0][0]);
308
+            $offset = $start + strlen($m[0][0]);
309 309
             $end = $this->getDelimPos($struct, $offset);
310 310
             if ($end === false) {
311 311
                 $result = substr($struct, $start);
312 312
             }
313 313
             else
314 314
             {
315
-                $result = substr($struct, $start, $end-$start);//already without ';'
315
+                $result = substr($struct, $start, $end - $start); //already without ';'
316 316
             }
317 317
         }
318 318
         $result = trim($result);
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
         $result = array();
331 331
         //find opening bracket, get the prefix along with it
332 332
         $openBracketPos = $this->getDelimPos($sql, 0, '(');
333
-        if ($openBracketPos===false) {
333
+        if ($openBracketPos === false) {
334 334
             trigger_error('[WARNING] can not find opening bracket in table definition');
335 335
             return false;
336 336
         }
337
-        $prefix = substr($sql, 0, $openBracketPos+1);//prefix can not be empty, so do not check it, just trim
337
+        $prefix = substr($sql, 0, $openBracketPos + 1); //prefix can not be empty, so do not check it, just trim
338 338
         $result[] = trim($prefix);
339
-        $body = substr($sql, strlen($prefix));//fields, indexes and part after closing bracket
339
+        $body = substr($sql, strlen($prefix)); //fields, indexes and part after closing bracket
340 340
         //split by commas, get part by part
341
-        while(($commaPos = $this->getDelimPos($body, 0, ',', true))!==false)
341
+        while (($commaPos = $this->getDelimPos($body, 0, ',', true)) !== false)
342 342
         {
343
-            $part = trim(substr($body, 0, $commaPos+1));//read another part and shorten $body
343
+            $part = trim(substr($body, 0, $commaPos + 1)); //read another part and shorten $body
344 344
             if ($part) {
345 345
                 $result[] = $part;
346 346
             }
347
-            $body = substr($body, $commaPos+1);
347
+            $body = substr($body, $commaPos + 1);
348 348
         }
349 349
         //here we have last field (or index) definition + part after closing bracket (ENGINE, ect)
350 350
         $closeBracketPos = $this->getDelimRpos($body, 0, ')');
351
-        if ($closeBracketPos===false) {
351
+        if ($closeBracketPos === false) {
352 352
             trigger_error('[WARNING] can not find closing bracket in table definition');
353 353
             return false;
354 354
         }
@@ -381,27 +381,27 @@  discard block
 block discarded – undo
381 381
     {
382 382
         $result = array();        
383 383
         //split with comma delimiter, not line breaks
384
-        $sourceParts =  $this->splitTabSql($sourceSql);
385
-        if ($sourceParts===false)//error parsing sql
384
+        $sourceParts = $this->splitTabSql($sourceSql);
385
+        if ($sourceParts === false)//error parsing sql
386 386
         {
387 387
             trigger_error('[WARNING] error parsing source sql');
388 388
             return false;
389 389
         }
390 390
         $destParts = $this->splitTabSql($destSql);
391
-        if ($destParts===false) {
391
+        if ($destParts === false) {
392 392
             trigger_error('[WARNING] error parsing destination sql');
393 393
             return false;
394 394
         }
395 395
         $sourcePartsIndexed = array();
396 396
         $destPartsIndexed = array();
397
-        foreach($sourceParts as $line)
397
+        foreach ($sourceParts as $line)
398 398
         {            
399 399
             $lineInfo = $this->processLine($line);
400 400
             if (!$lineInfo) { continue; 
401 401
             }
402 402
             $sourcePartsIndexed[$lineInfo['key']] = $lineInfo['line'];
403 403
         }
404
-        foreach($destParts as $line)
404
+        foreach ($destParts as $line)
405 405
         {            
406 406
             $lineInfo = $this->processLine($line);
407 407
             if (!$lineInfo) { continue; 
@@ -411,16 +411,16 @@  discard block
 block discarded – undo
411 411
         $sourceKeys = array_keys($sourcePartsIndexed);
412 412
         $destKeys = array_keys($destPartsIndexed);
413 413
         $all = array_unique(array_merge($sourceKeys, $destKeys));
414
-        sort($all);//fields first, then indexes - because fields are prefixed with '!'
414
+        sort($all); //fields first, then indexes - because fields are prefixed with '!'
415 415
 
416 416
         foreach ($all as $key)
417 417
         {
418 418
             $info = array('source'=>'', 'dest'=>'');
419
-            $inSource= in_array($key, $sourceKeys);
420
-            $inDest= in_array($key, $destKeys);
419
+            $inSource = in_array($key, $sourceKeys);
420
+            $inDest = in_array($key, $destKeys);
421 421
             $sourceOrphan = $inSource && !$inDest;
422 422
             $destOrphan = $inDest && !$inSource;
423
-            $different =  $inSource && $inDest && $destPartsIndexed[$key]!=$sourcePartsIndexed[$key];
423
+            $different = $inSource && $inDest && $destPartsIndexed[$key] != $sourcePartsIndexed[$key];
424 424
             if ($sourceOrphan) {
425 425
                 $info['source'] = $sourcePartsIndexed[$key];
426 426
             }
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
         }
463 463
         elseif (preg_match('/^`?\w+`?/i', $line, $m))//field definition
464 464
         {
465
-            $key = '!'.$m[0];//to make sure fields will be synchronised before the keys
465
+            $key = '!'.$m[0]; //to make sure fields will be synchronised before the keys
466 466
         }
467 467
         else
468 468
         {
469
-            return false;//line has no valuable info (empty or comment)
469
+            return false; //line has no valuable info (empty or comment)
470 470
         }
471 471
         //$key = str_replace('`', '', $key);
472 472
         if (!empty($options['varcharDefaultIgnore'])) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             $line = preg_replace("/ AUTO_INCREMENT=[0-9]+/i", '', $line);
480 480
         }
481 481
         $result['key'] = $key;
482
-        $result['line']= $line;
482
+        $result['line'] = $line;
483 483
         return $result;
484 484
     }
485 485
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         if (!is_array($diff) || empty($diff)) {
500 500
             return $sqls;
501 501
         }
502
-        foreach($diff as $tab=>$info)
502
+        foreach ($diff as $tab=>$info)
503 503
         {
504 504
             if ($info['sourceOrphan'])//delete it
505 505
             {
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
             }
523 523
             else
524 524
             {
525
-                foreach($info['differs'] as $finfo)
525
+                foreach ($info['differs'] as $finfo)
526 526
                 {
527 527
                     $inDest = !empty($finfo['dest']);
528 528
                     $inSource = !empty($finfo['source']);
@@ -560,45 +560,45 @@  discard block
 block discarded – undo
560 560
     {
561 561
         $result = 'ALTER TABLE `'.$tab.'` ';
562 562
         $action = strtolower($action);
563
-        $keyField = '`?\w`?(?:\(\d+\))?';//matches `name`(10)
564
-        $keyFieldList = '(?:'.$keyField.'(?:,\s?)?)+';//matches `name`(10),`desc`(255)
563
+        $keyField = '`?\w`?(?:\(\d+\))?'; //matches `name`(10)
564
+        $keyFieldList = '(?:'.$keyField.'(?:,\s?)?)+'; //matches `name`(10),`desc`(255)
565 565
         if (preg_match('/((?:PRIMARY )|(?:UNIQUE )|(?:FULLTEXT ))?KEY `?(\w+)?`?\s(\('.$keyFieldList.'\))/i', $sql, $m)) {   //key and index operations
566 566
             $type = strtolower(trim($m[1]));
567 567
             $name = trim($m[2]);
568 568
             $fields = trim($m[3]);
569
-            switch($action)
569
+            switch ($action)
570 570
             {
571 571
             case 'drop':
572
-                if ($type=='primary') {
573
-                    $result.= 'DROP PRIMARY KEY';
572
+                if ($type == 'primary') {
573
+                    $result .= 'DROP PRIMARY KEY';
574 574
                 }
575 575
                 else
576 576
                 {
577
-                    $result.= 'DROP INDEX `'.$name.'`';
577
+                    $result .= 'DROP INDEX `'.$name.'`';
578 578
                 }
579 579
                 break;
580 580
             case 'add':
581
-                if ($type=='primary') {
582
-                    $result.= 'ADD PRIMARY KEY '.$fields;
581
+                if ($type == 'primary') {
582
+                    $result .= 'ADD PRIMARY KEY '.$fields;
583 583
                 }
584
-                elseif ($type=='') {
585
-                    $result.= 'ADD INDEX `'.$name.'` '.$fields;
584
+                elseif ($type == '') {
585
+                    $result .= 'ADD INDEX `'.$name.'` '.$fields;
586 586
                 }
587 587
                 else
588 588
                 {
589
-                    $result .='ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
589
+                    $result .= 'ADD '.strtoupper($type).' `'.$name.'` '.$fields; //fulltext or unique
590 590
                 }
591 591
                 break;
592 592
             case 'modify':
593
-                if ($type=='primary') {
594
-                    $result.='DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields;
593
+                if ($type == 'primary') {
594
+                    $result .= 'DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields;
595 595
                 }
596
-                elseif ($type=='') {
597
-                    $result.='DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields;
596
+                elseif ($type == '') {
597
+                    $result .= 'DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields;
598 598
                 }
599 599
                 else
600 600
                 {
601
-                    $result.='DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
601
+                    $result .= 'DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields; //fulltext or unique
602 602
                 }
603 603
                 break;
604 604
 
@@ -607,14 +607,14 @@  discard block
 block discarded – undo
607 607
         else //fields operations
608 608
         {
609 609
             $sql = rtrim(trim($sql), ',');
610
-            $result.= strtoupper($action);
611
-            if ($action=='drop') {
610
+            $result .= strtoupper($action);
611
+            if ($action == 'drop') {
612 612
                 $spacePos = strpos($sql, ' ');
613
-                $result.= ' '.substr($sql, 0, $spacePos);
613
+                $result .= ' '.substr($sql, 0, $spacePos);
614 614
             }
615 615
             else
616 616
             {
617
-                $result.= ' '.$sql;
617
+                $result .= ' '.$sql;
618 618
             }
619 619
         }
620 620
         return $result;
@@ -629,34 +629,34 @@  discard block
 block discarded – undo
629 629
     *
630 630
     * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts
631 631
     */
632
-    public function getDelimPos($string, $offset=0, $delim=';', $skipInBrackets=false)
632
+    public function getDelimPos($string, $offset = 0, $delim = ';', $skipInBrackets = false)
633 633
     {
634 634
         $stack = array();
635
-        $rbs = '\\\\';    //reg - escaped backslash
635
+        $rbs = '\\\\'; //reg - escaped backslash
636 636
         $regPrefix = "(?<!$rbs)(?:$rbs{2})*";
637 637
         $reg = $regPrefix.'("|\')|(/\\*)|(\\*/)|(-- )|(\r\n|\r|\n)|';
638 638
         if ($skipInBrackets) {
639
-            $reg.='(\(|\))|';
639
+            $reg .= '(\(|\))|';
640 640
         }
641 641
         else 
642 642
         {
643
-            $reg.='()';
643
+            $reg .= '()';
644 644
         }
645 645
         $reg .= '('.preg_quote($delim).')';
646 646
         while (preg_match('%'.$reg.'%', $string, $m, PREG_OFFSET_CAPTURE, $offset))
647 647
         {
648
-            $offset = $m[0][1]+strlen($m[0][0]);
649
-            if (end($stack)=='/*') {
648
+            $offset = $m[0][1] + strlen($m[0][0]);
649
+            if (end($stack) == '/*') {
650 650
                 if (!empty($m[3][0])) {
651 651
                     array_pop($stack);
652 652
                 }
653
-                continue;//here we could also simplify regexp
653
+                continue; //here we could also simplify regexp
654 654
             }
655
-            if (end($stack)=='-- ') {
655
+            if (end($stack) == '-- ') {
656 656
                 if (!empty($m[5][0])) {
657 657
                     array_pop($stack);
658 658
                 }
659
-                continue;//here we could also simplify regexp
659
+                continue; //here we could also simplify regexp
660 660
             }
661 661
 
662 662
             if (!empty($m[7][0]))// ';' found
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
             }
672 672
             if (!empty($m[6][0]))// '(' or ')' found
673 673
             {
674
-                if (empty($stack) && $m[6][0]=='(') {
674
+                if (empty($stack) && $m[6][0] == '(') {
675 675
                     array_push($stack, $m[6][0]);
676 676
                 }
677
-                elseif($m[6][0]==')' && end($stack)=='(') {
677
+                elseif ($m[6][0] == ')' && end($stack) == '(') {
678 678
                     array_pop($stack);
679 679
                 }
680 680
             }
681 681
             elseif (!empty($m[1][0]))// ' or " found
682 682
             {
683
-                if (end($stack)==$m[1][0]) {
683
+                if (end($stack) == $m[1][0]) {
684 684
                     array_pop($stack);
685 685
                 }
686 686
                 else
@@ -704,20 +704,20 @@  discard block
 block discarded – undo
704 704
     * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from
705 705
     * the end of the string
706 706
     */
707
-    public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false)
707
+    public function getDelimRpos($string, $offset = 0, $delim = ';', $skipInBrackets = false)
708 708
     {
709 709
         $pos = $this->getDelimPos($string, $offset, $delim, $skipInBrackets);
710
-        if ($pos===false) {
710
+        if ($pos === false) {
711 711
             return false;
712 712
         }
713 713
         do
714 714
         {
715
-            $newPos=$this->getDelimPos($string, $pos+1, $delim, $skipInBrackets);
715
+            $newPos = $this->getDelimPos($string, $pos + 1, $delim, $skipInBrackets);
716 716
             if ($newPos !== false) {
717 717
                 $pos = $newPos;
718 718
             }
719 719
         }
720
-        while($newPos!==false);
720
+        while ($newPos !== false);
721 721
         return $pos;
722 722
     }
723 723
 }
Please login to merge, or discard this patch.
Braces   +67 added lines, -75 removed lines patch added patch discarded remove patch
@@ -142,8 +142,7 @@  discard block
 block discarded – undo
142 142
         $result = array();
143 143
         if (is_array($this->config['updateTypes'])) {
144 144
             $updateActions = $this->config['updateTypes'];
145
-        }
146
-        else
145
+        } else
147 146
         {
148 147
             $updateActions = array_map('trim', explode(',', $this->config['updateTypes']));
149 148
         }
@@ -155,24 +154,20 @@  discard block
 block discarded – undo
155 154
                 if (in_array('create', $updateActions)) {
156 155
                     $result[$table] = $info;
157 156
                 }
158
-            }
159
-            elseif ($info['destOrphan']) {
157
+            } elseif ($info['destOrphan']) {
160 158
                 if (in_array('drop', $updateActions)) {
161 159
                     $result[$table] = $info;
162 160
                 }
163
-            }
164
-            elseif($info['differs']) {
161
+            } elseif($info['differs']) {
165 162
                 $resultInfo = $info;
166 163
                 unset($resultInfo['differs']);
167 164
                 foreach ($info['differs'] as $diff)
168 165
                 {
169 166
                     if (empty($diff['dest']) && in_array('add', $updateActions)) {
170 167
                         $resultInfo['differs'][] = $diff;
171
-                    }
172
-                    elseif (empty($diff['source']) && in_array('remove', $updateActions)) {
168
+                    } elseif (empty($diff['source']) && in_array('remove', $updateActions)) {
173 169
                         $resultInfo['differs'][] = $diff;
174
-                    }
175
-                    elseif(in_array('modify', $updateActions)) {
170
+                    } elseif(in_array('modify', $updateActions)) {
176 171
                         $resultInfo['differs'][] = $diff;
177 172
                     }
178 173
                 }
@@ -198,11 +193,9 @@  discard block
 block discarded – undo
198 193
         {
199 194
             if ($info['sourceOrphan']) {
200 195
                 $result['sourceOrphans'][] = $table;
201
-            }
202
-            elseif ($info['destOrphan']) {
196
+            } elseif ($info['destOrphan']) {
203 197
                 $result['destOrphans'][] = $table;
204
-            }
205
-            else
198
+            } else
206 199
             {
207 200
                 $result['different'][] = $table;
208 201
             }
@@ -244,11 +237,9 @@  discard block
 block discarded – undo
244 237
             $info = array('destOrphan'=>false, 'sourceOrphan'=>false, 'differs'=>false);
245 238
             if(in_array($tab, $destOrphans)) {
246 239
                 $info['destOrphan'] = true;
247
-            }
248
-            elseif (in_array($tab, $sourceOrphans)) {
240
+            } elseif (in_array($tab, $sourceOrphans)) {
249 241
                 $info['sourceOrphan'] = true;
250
-            }
251
-            else
242
+            } else
252 243
             {                
253 244
                 $destSql = $this->getTabSql($this->destStruct, $tab, true);
254 245
                 $sourceSql = $this->getTabSql($this->sourceStruct, $tab, true);
@@ -256,12 +247,12 @@  discard block
 block discarded – undo
256 247
                 if ($diffs===false) {
257 248
                     trigger_error('[WARNING] error parsing definition of table "'.$tab.'" - skipped');
258 249
                     continue;
259
-                }
260
-                elseif (!empty($diffs))//not empty array
250
+                } elseif (!empty($diffs)) {
251
+                    //not empty array
261 252
                 {
262
-                    $info['differs'] = $diffs;                    
263
-                }                
264
-                else { continue;//empty array
253
+                    $info['differs'] = $diffs;
254
+                }
255
+                } else { continue;//empty array
265 256
                 }         
266 257
             }
267 258
             $result[$tab] = $info;
@@ -279,10 +270,12 @@  discard block
 block discarded – undo
279 270
     {
280 271
         $result = array();
281 272
         if (preg_match_all('/CREATE(?:\s*TEMPORARY)?\s*TABLE\s*(?:IF NOT EXISTS\s*)?(?:`?(\w+)`?\.)?`?(\w+)`?/i', $struct, $m)) {
282
-            foreach($m[2] as $match)//m[1] is a database name if any
273
+            foreach($m[2] as $match) {
274
+                //m[1] is a database name if any
283 275
             {
284 276
                 $result[] = $match;
285 277
             }
278
+            }
286 279
         }
287 280
         return $result;
288 281
     }
@@ -309,8 +302,7 @@  discard block
 block discarded – undo
309 302
             $end = $this->getDelimPos($struct, $offset);
310 303
             if ($end === false) {
311 304
                 $result = substr($struct, $start);
312
-            }
313
-            else
305
+            } else
314 306
             {
315 307
                 $result = substr($struct, $start, $end-$start);//already without ';'
316 308
             }
@@ -382,9 +374,11 @@  discard block
 block discarded – undo
382 374
         $result = array();        
383 375
         //split with comma delimiter, not line breaks
384 376
         $sourceParts =  $this->splitTabSql($sourceSql);
385
-        if ($sourceParts===false)//error parsing sql
377
+        if ($sourceParts===false) {
378
+            //error parsing sql
386 379
         {
387 380
             trigger_error('[WARNING] error parsing source sql');
381
+        }
388 382
             return false;
389 383
         }
390 384
         $destParts = $this->splitTabSql($destSql);
@@ -423,15 +417,12 @@  discard block
 block discarded – undo
423 417
             $different =  $inSource && $inDest && $destPartsIndexed[$key]!=$sourcePartsIndexed[$key];
424 418
             if ($sourceOrphan) {
425 419
                 $info['source'] = $sourcePartsIndexed[$key];
426
-            }
427
-            elseif ($destOrphan) {
420
+            } elseif ($destOrphan) {
428 421
                 $info['dest'] = $destPartsIndexed[$key];
429
-            }
430
-            elseif ($different) {
422
+            } elseif ($different) {
431 423
                 $info['source'] = $sourcePartsIndexed[$key];
432 424
                 $info['dest'] = $destPartsIndexed[$key];
433
-            }
434
-            else { continue; 
425
+            } else { continue; 
435 426
             }
436 427
             $result[] = $info;
437 428
         }
@@ -452,19 +443,24 @@  discard block
 block discarded – undo
452 443
         $options = $this->config;
453 444
         $result = array('key'=>'', 'line'=>'');
454 445
         $line = rtrim(trim($line), ',');
455
-        if (preg_match('/^(CREATE TABLE)|(\) ENGINE=)/i', $line))//first or last table definition line
446
+        if (preg_match('/^(CREATE TABLE)|(\) ENGINE=)/i', $line)) {
447
+            //first or last table definition line
456 448
         {
457 449
             return false;
458 450
         }
459
-        if (preg_match('/^(PRIMARY KEY)|(((UNIQUE )|(FULLTEXT ))?KEY `?\w+`?)/i', $line, $m))//key definition
451
+        }
452
+        if (preg_match('/^(PRIMARY KEY)|(((UNIQUE )|(FULLTEXT ))?KEY `?\w+`?)/i', $line, $m)) {
453
+            //key definition
460 454
         {
461 455
             $key = $m[0];
462 456
         }
463
-        elseif (preg_match('/^`?\w+`?/i', $line, $m))//field definition
457
+        } elseif (preg_match('/^`?\w+`?/i', $line, $m)) {
458
+            //field definition
464 459
         {
465
-            $key = '!'.$m[0];//to make sure fields will be synchronised before the keys
460
+            $key = '!'.$m[0];
466 461
         }
467
-        else
462
+        //to make sure fields will be synchronised before the keys
463
+        } else
468 464
         {
469 465
             return false;//line has no valuable info (empty or comment)
470 466
         }
@@ -501,13 +497,16 @@  discard block
 block discarded – undo
501 497
         }
502 498
         foreach($diff as $tab=>$info)
503 499
         {
504
-            if ($info['sourceOrphan'])//delete it
500
+            if ($info['sourceOrphan']) {
501
+                //delete it
505 502
             {
506 503
                 $sqls[] = 'DROP TABLE `'.$tab.'`';
507 504
             }
508
-            elseif ($info['destOrphan'])//create destination table in source
505
+            } elseif ($info['destOrphan']) {
506
+                //create destination table in source
509 507
             {
510 508
                 $database = '';
509
+            }
511 510
                 $destSql = $this->getTabSql($this->destStruct, $tab, $database);
512 511
                 if (!empty($options['ignoreIncrement'])) {
513 512
                     $destSql = preg_replace("/\s*AUTO_INCREMENT=[0-9]+/i", '', $destSql);
@@ -519,8 +518,7 @@  discard block
 block discarded – undo
519 518
                     $destSql = preg_replace('/(CREATE(?:\s*TEMPORARY)?\s*TABLE\s*)(?:IF NOT EXISTS\s*)?(`?\w+`?)/i', '$1IF NOT EXISTS $2', $destSql);
520 519
                 }
521 520
                 $sqls[] = $destSql;
522
-            }
523
-            else
521
+            } else
524 522
             {
525 523
                 foreach($info['differs'] as $finfo)
526 524
                 {
@@ -529,12 +527,10 @@  discard block
 block discarded – undo
529 527
                     if ($inSource && !$inDest) {
530 528
                         $sql = $finfo['source'];
531 529
                         $action = 'drop';
532
-                    }
533
-                    elseif ($inDest && !$inSource) {
530
+                    } elseif ($inDest && !$inSource) {
534 531
                         $sql = $finfo['dest'];
535 532
                         $action = 'add';
536
-                    }
537
-                    else
533
+                    } else
538 534
                     {
539 535
                         $sql = $finfo['dest'];
540 536
                         $action = 'modify';
@@ -571,8 +567,7 @@  discard block
 block discarded – undo
571 567
             case 'drop':
572 568
                 if ($type=='primary') {
573 569
                     $result.= 'DROP PRIMARY KEY';
574
-                }
575
-                else
570
+                } else
576 571
                 {
577 572
                     $result.= 'DROP INDEX `'.$name.'`';
578 573
                 }
@@ -580,11 +575,9 @@  discard block
 block discarded – undo
580 575
             case 'add':
581 576
                 if ($type=='primary') {
582 577
                     $result.= 'ADD PRIMARY KEY '.$fields;
583
-                }
584
-                elseif ($type=='') {
578
+                } elseif ($type=='') {
585 579
                     $result.= 'ADD INDEX `'.$name.'` '.$fields;
586
-                }
587
-                else
580
+                } else
588 581
                 {
589 582
                     $result .='ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
590 583
                 }
@@ -592,27 +585,23 @@  discard block
 block discarded – undo
592 585
             case 'modify':
593 586
                 if ($type=='primary') {
594 587
                     $result.='DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields;
595
-                }
596
-                elseif ($type=='') {
588
+                } elseif ($type=='') {
597 589
                     $result.='DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields;
598
-                }
599
-                else
590
+                } else
600 591
                 {
601 592
                     $result.='DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique
602 593
                 }
603 594
                 break;
604 595
 
605 596
             }
606
-        }
607
-        else //fields operations
597
+        } else //fields operations
608 598
         {
609 599
             $sql = rtrim(trim($sql), ',');
610 600
             $result.= strtoupper($action);
611 601
             if ($action=='drop') {
612 602
                 $spacePos = strpos($sql, ' ');
613 603
                 $result.= ' '.substr($sql, 0, $spacePos);
614
-            }
615
-            else
604
+            } else
616 605
             {
617 606
                 $result.= ' '.$sql;
618 607
             }
@@ -637,8 +626,7 @@  discard block
 block discarded – undo
637 626
         $reg = $regPrefix.'("|\')|(/\\*)|(\\*/)|(-- )|(\r\n|\r|\n)|';
638 627
         if ($skipInBrackets) {
639 628
             $reg.='(\(|\))|';
640
-        }
641
-        else 
629
+        } else 
642 630
         {
643 631
             $reg.='()';
644 632
         }
@@ -659,43 +647,47 @@  discard block
 block discarded – undo
659 647
                 continue;//here we could also simplify regexp
660 648
             }
661 649
 
662
-            if (!empty($m[7][0]))// ';' found
650
+            if (!empty($m[7][0])) {
651
+                // ';' found
663 652
             {
664 653
                 if (empty($stack)) {
665 654
                     return $m[7][1];
666
-                }
667
-                else
655
+            }
656
+                } else
668 657
                 {
669 658
                     //var_dump($stack, substr($string, $offset-strlen($m[0][0])));
670 659
                 }
671 660
             }
672
-            if (!empty($m[6][0]))// '(' or ')' found
661
+            if (!empty($m[6][0])) {
662
+                // '(' or ')' found
673 663
             {
674 664
                 if (empty($stack) && $m[6][0]=='(') {
675 665
                     array_push($stack, $m[6][0]);
676
-                }
677
-                elseif($m[6][0]==')' && end($stack)=='(') {
666
+            }
667
+                } elseif($m[6][0]==')' && end($stack)=='(') {
678 668
                     array_pop($stack);
679 669
                 }
680
-            }
681
-            elseif (!empty($m[1][0]))// ' or " found
670
+            } elseif (!empty($m[1][0])) {
671
+                // ' or " found
682 672
             {
683 673
                 if (end($stack)==$m[1][0]) {
684 674
                     array_pop($stack);
685
-                }
686
-                else
675
+            }
676
+                } else
687 677
                 {
688 678
                     array_push($stack, $m[1][0]);
689 679
                 }
690
-            }
691
-            elseif (!empty($m[2][0])) // opening comment / *
680
+            } elseif (!empty($m[2][0])) {
681
+                // opening comment / *
692 682
             {
693 683
                 array_push($stack, $m[2][0]);
694 684
             }
695
-            elseif (!empty($m[4][0])) // opening comment --
685
+            } elseif (!empty($m[4][0])) {
686
+                // opening comment --
696 687
             {
697 688
                 array_push($stack, $m[4][0]);
698 689
             }
690
+            }
699 691
         }
700 692
         return false;
701 693
     }
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Element.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@
 block discarded – undo
33 33
      */
34 34
     public function __invoke($options = array())
35 35
     {
36
-        if ( is_object($options) && method_exists($options, 'toArray') ) {
36
+        if (is_object($options) && method_exists($options, 'toArray')) {
37 37
             $options = $options->toArray();
38
-        } else if ( is_object($options) ) {
39
-            $options = (array)$options;
38
+        } else if (is_object($options)) {
39
+            $options = (array) $options;
40 40
         }
41 41
         
42 42
         if (isset($options['container']) && (null !== $options['container'])) {
Please login to merge, or discard this patch.
UIComponents/src/UIComponents/View/Helper/Components/PluginManager.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected $invokableClasses = [
35 35
 
36
-    	// panels
37
-    	//
36
+        // panels
37
+        //
38 38
         'element'              => 'UIComponents\View\Helper\Components\Element',
39 39
         'block'             => 'UIComponents\View\Helper\Components\Block',
40 40
         //'well'              => 'UIComponents\View\Helper\Components\Well',
@@ -43,33 +43,33 @@  discard block
 block discarded – undo
43 43
         'widget'            => 'UIComponents\View\Helper\Components\Widget',
44 44
         'dashboard'         => 'UIComponents\View\Helper\Components\Dashboard',
45 45
 
46
-    	// page components
47
-    	//
46
+        // page components
47
+        //
48 48
         'nav'               => 'UIComponents\View\Helper\Components\Navbar', // set 'alias to' or combine with 'Navbars' !
49 49
         'topbar'            => 'UIComponents\View\Helper\Components\Navbar', // set 'alias to' or combine with 'Navbars' !
50 50
         'breadcrumbs'       => 'UIComponents\View\Helper\Components\Breadcrumbs',
51 51
         'languagemenu'      => 'UIComponents\View\Helper\Components\Languagemenu',
52
-    	'toolbar'           => 'UIComponents\View\Helper\Components\Toolbar',
52
+        'toolbar'           => 'UIComponents\View\Helper\Components\Toolbar',
53 53
 
54 54
         // controls
55 55
         //
56 56
         'button'            => 'UIComponents\View\Helper\Components\Button', // default, drop-down/up, splitted
57 57
         'buttongroup'       => 'UIComponents\View\Helper\Components\Buttongroup',
58
-    	//'inputgroup'        => 'UIComponents\View\Helper\Components\Inputgroup',
58
+        //'inputgroup'        => 'UIComponents\View\Helper\Components\Inputgroup',
59 59
         //'progressbar'       => 'UIComponents\View\Helper\Components\Progressbar',
60 60
 
61
-    	// forms
62
-    	//
61
+        // forms
62
+        //
63 63
         'formgroup'         => 'UIComponents\View\Helper\Components\Formgroup',
64 64
 
65
-    	// lists/tables
66
-    	//
65
+        // lists/tables
66
+        //
67 67
         //'listgroup'         => 'UIComponents\View\Helper\Components\Listgroup',
68 68
         'table'         	=> 'UIComponents\View\Helper\Components\Listgroup',
69
-    	//'pagination'        => 'UIComponents\View\Helper\Components\Pagination',
69
+        //'pagination'        => 'UIComponents\View\Helper\Components\Pagination',
70 70
 
71
-    	// widgets
72
-    	//
71
+        // widgets
72
+        //
73 73
         //'label'             => 'UIComponents\View\Helper\Components\Label',
74 74
         //'badge'             => 'UIComponents\View\Helper\Components\Badge',
75 75
         //'pageheader'        => 'UIComponents\View\Helper\Components\Pageheader',
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Utilities.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     
72 72
             $controller = $params['controller'];
73 73
             if (isset($params['__NAMESPACE__'])) {
74
-                $controller = $params['__NAMESPACE__'] . '\\' . $params['controller'];
74
+                $controller = $params['__NAMESPACE__'].'\\'.$params['controller'];
75 75
             }
76 76
             $action = $params['action'];
77 77
     
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $info = $this->requestInfo();
104 104
         if ($info) {
105
-            $slug = strtolower($info['module']) . '-' . 
106
-                strtolower($info['controller']) . '-' . 
105
+            $slug = strtolower($info['module']).'-'. 
106
+                strtolower($info['controller']).'-'. 
107 107
                 strtolower($info['action']);
108 108
     
109 109
             return $slug;
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Navigation/Menu.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Menu extends \Zend\View\Helper\Navigation\Menu
31 31
 {
32
-	use ComponentClassnamesTrait;
33
-	use ComponentAttributesTrait;
32
+    use ComponentClassnamesTrait;
33
+    use ComponentAttributesTrait;
34 34
 
35 35
     /**
36 36
      * default CSS class to use for li elements
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
      */
354 354
     public function findActive($container = null, $minDepth = null, $maxDepth = -1)
355 355
     {
356
-    	if ( null == $container ) {
357
-    		$container = $this->getContainer();
358
-    	}
359
-    	return parent::findActive($container, $minDepth, $maxDepth);
356
+        if ( null == $container ) {
357
+            $container = $this->getContainer();
358
+        }
359
+        return parent::findActive($container, $minDepth, $maxDepth);
360 360
     }
361 361
     
362 362
     /**
Please login to merge, or discard this patch.
Spacing   +30 added lines, -31 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $escaper = $this->view->plugin('escapeHtmlAttr');
213 213
 
214 214
         if ($found) {
215
-            $foundPage    = $found['page'];
215
+            $foundPage = $found['page'];
216 216
             $foundDepth = $found['depth'];
217 217
         } else {
218 218
             $foundPage = null;
@@ -261,34 +261,33 @@  discard block
 block discarded – undo
261 261
 
262 262
             // make sure indentation is correct
263 263
             $depth -= $minDepth;
264
-            $myIndent = $indent . str_repeat('    ', $depth);
264
+            $myIndent = $indent.str_repeat('    ', $depth);
265 265
             $attributes = $this->getAttributes();
266 266
             if ($depth > $prevDepth) {
267 267
                 // start new ul tag
268
-                $ulClass = '' . 
269
-                    ($depth == 0 ? $this->getUlClass() : 
270
-                            ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass())
271
-                    ) . 
272
-                    ' level_' . $depth . 
268
+                $ulClass = ''. 
269
+                    ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass())
270
+                    ). 
271
+                    ' level_'.$depth. 
273 272
                 '';
274
-                if ($ulClass && $depth ==    0) {
275
-                    $ulClass = ' class="' . $escaper($ulClass) . '"';
273
+                if ($ulClass && $depth == 0) {
274
+                    $ulClass = ' class="'.$escaper($ulClass).'"';
276 275
                 } else {
277
-                    $ulClass = ' class="' . $escaper($ulClass) . '"';
276
+                    $ulClass = ' class="'.$escaper($ulClass).'"';
278 277
                 }
279
-                $html .= $myIndent . '<ul' . $ulClass . ' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>' . PHP_EOL;
278
+                $html .= $myIndent.'<ul'.$ulClass.' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>'.PHP_EOL;
280 279
             } elseif ($prevDepth > $depth) {
281 280
                 // close li/ul tags until we're at current depth
282 281
                 for ($i = $prevDepth; $i > $depth; $i--) {
283
-                    $ind = $indent . str_repeat('        ', $i);
284
-                    $html .= $ind . '    </li>' . PHP_EOL;
285
-                    $html .= $ind . '</ul>' . PHP_EOL;
282
+                    $ind = $indent.str_repeat('        ', $i);
283
+                    $html .= $ind.'    </li>'.PHP_EOL;
284
+                    $html .= $ind.'</ul>'.PHP_EOL;
286 285
                 }
287 286
                 // close previous li tag
288
-                $html .= $myIndent . '    </li>' . PHP_EOL;
287
+                $html .= $myIndent.'    </li>'.PHP_EOL;
289 288
             } else {
290 289
                 // close previous li tag
291
-                $html .= $myIndent . '    </li>' . PHP_EOL;
290
+                $html .= $myIndent.'    </li>'.PHP_EOL;
292 291
             }
293 292
 
294 293
             // render li tag and page
@@ -308,10 +307,10 @@  discard block
 block discarded – undo
308 307
             if ($addClassToListItem && $page->getClass()) {
309 308
                 $liClasses[] = $page->getClass();
310 309
             }
311
-            $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"';
310
+            $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"';
312 311
 
313
-            $html .= $myIndent . '    <li' . $liClass . '>' . PHP_EOL
314
-                . $myIndent . '        ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL;
312
+            $html .= $myIndent.'    <li'.$liClass.'>'.PHP_EOL
313
+                . $myIndent.'        '.$this->htmlify($page, $escapeLabels, $addClassToListItem).PHP_EOL;
315 314
 
316 315
             // store as previous depth for next iteration
317 316
             $prevDepth = $depth;
@@ -319,10 +318,10 @@  discard block
 block discarded – undo
319 318
 
320 319
         if ($html) {
321 320
             // done iterating container; close open ul/li tags
322
-            for ($i = $prevDepth+1; $i > 0; $i--) {
323
-                $myIndent = $indent . str_repeat('        ', $i-1);
324
-                $html .= $myIndent . '    </li>' . PHP_EOL
325
-                    . $myIndent . '</ul>' . PHP_EOL;
321
+            for ($i = $prevDepth + 1; $i > 0; $i--) {
322
+                $myIndent = $indent.str_repeat('        ', $i - 1);
323
+                $html .= $myIndent.'    </li>'.PHP_EOL
324
+                    . $myIndent.'</ul>'.PHP_EOL;
326 325
             }
327 326
             $html = rtrim($html, PHP_EOL);
328 327
         }
@@ -353,7 +352,7 @@  discard block
 block discarded – undo
353 352
      */
354 353
     public function findActive($container = null, $minDepth = null, $maxDepth = -1)
355 354
     {
356
-    	if ( null == $container ) {
355
+    	if (null == $container) {
357 356
     		$container = $this->getContainer();
358 357
     	}
359 358
     	return parent::findActive($container, $minDepth, $maxDepth);
@@ -370,7 +369,7 @@  discard block
 block discarded – undo
370 369
      * @param    bool         $addClassToListItem Whether or not to add the page class to the list item
371 370
      * @return string
372 371
      */
373
-    public function htmlify(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false, $extraAttributes = [] )
372
+    public function htmlify(AbstractPage $page, $escapeLabel = true, $addClassToListItem = false, $extraAttributes = [])
374 373
     {
375 374
         $partial = $this->getHtmlifyPartial();
376 375
         if ($partial) {
@@ -380,11 +379,11 @@  discard block
 block discarded – undo
380 379
         $attribs = array_merge([
381 380
                 'id'     => $page->getId(),
382 381
                 'title'    => $this->translate($page->getTitle(), $page->getTextDomain()),
383
-                'data-test'    => 'cta-nav-' . $this->slugify($page->getLabel()),
382
+                'data-test'    => 'cta-nav-'.$this->slugify($page->getLabel()),
384 383
         ], $extraAttributes);
385 384
         
386 385
         $classnames = array();
387
-        if ( $addClassToListItem === false ) {
386
+        if ($addClassToListItem === false) {
388 387
             $class = $page->getClass();
389 388
             if (!empty($class)) {
390 389
                 $classnames[] = $page->getClass();
@@ -393,7 +392,7 @@  discard block
 block discarded – undo
393 392
         $maxDepth = $this->getMaxDepth();
394 393
         $depth = $page->get('level');
395 394
         $isBelowMaxLevel = ($maxDepth > $depth) || ($maxDepth === null) || ($maxDepth === false);
396
-        if ( !empty($page->pages) && $isBelowMaxLevel ) {
395
+        if (!empty($page->pages) && $isBelowMaxLevel) {
397 396
             $classnames[] = 'dropdown-toggle';
398 397
             $attribs['data-toggle'] = (($depth == 0) ? $this->getSubLiClassLevel0() : $this->getSubLiClass());
399 398
         }
@@ -412,8 +411,8 @@  discard block
 block discarded – undo
412 411
             $attribs['href'] = '#';
413 412
         }
414 413
         
415
-        $html    = '<' . $element . $this->htmlAttribs($attribs) . '>';
416
-        $html .= ($page->get('icon') ? '<span class="' . $this->getIconPrefixClass() . '' . $page->get('icon') . '"></span> ' : '' );
414
+        $html = '<'.$element.$this->htmlAttribs($attribs).'>';
415
+        $html .= ($page->get('icon') ? '<span class="'.$this->getIconPrefixClass().''.$page->get('icon').'"></span> ' : '');
417 416
         $label = $this->translate($page->getLabel(), $page->getTextDomain());
418 417
         if ($escapeLabel === true) {
419 418
             /** @var \Zend\View\Helper\EscapeHtml $escaper */
@@ -422,7 +421,7 @@  discard block
 block discarded – undo
422 421
         } else {
423 422
             $html .= $label;
424 423
         }
425
-        $html .= '</' . $element . '>';
424
+        $html .= '</'.$element.'>';
426 425
     
427 426
         return $html;
428 427
     }
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Toolbar.php 1 patch
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $escaper = $this->view->plugin('escapeHtmlAttr');
98 98
 
99 99
         if ($found) {
100
-            $foundPage    = $found['page'];
100
+            $foundPage = $found['page'];
101 101
             $foundDepth = $found['depth'];
102 102
         } else {
103 103
             $foundPage = null;
@@ -146,28 +146,27 @@  discard block
 block discarded – undo
146 146
 
147 147
             // make sure indentation is correct
148 148
             $depth -= $minDepth;
149
-            $myIndent = $indent . str_repeat('    ', $depth);
149
+            $myIndent = $indent.str_repeat('    ', $depth);
150 150
 
151 151
             if ($depth > $prevDepth) {
152 152
                 // start new ul tag
153
-                $ulClass = '' . 
154
-                    ($depth == 0 ? $this->getUlClass() : 
155
-                            ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass())
156
-                    ) . 
157
-                    ' level_' . $depth . 
153
+                $ulClass = ''. 
154
+                    ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass())
155
+                    ). 
156
+                    ' level_'.$depth. 
158 157
                 '';
159
-                if ($ulClass && $depth ==    0) {
160
-                    $ulClass = ' class="' . $escaper($ulClass) . '"';
158
+                if ($ulClass && $depth == 0) {
159
+                    $ulClass = ' class="'.$escaper($ulClass).'"';
161 160
                 } else {
162
-                    $ulClass = ' class="' . $escaper($ulClass) . '"';
161
+                    $ulClass = ' class="'.$escaper($ulClass).'"';
163 162
                 }
164
-                $html .= $myIndent . '<' . $this->getTagname() . $ulClass . '>' . PHP_EOL;
163
+                $html .= $myIndent.'<'.$this->getTagname().$ulClass.'>'.PHP_EOL;
165 164
             } elseif ($prevDepth > $depth) {
166 165
                 // close li/ul tags until we're at current depth
167 166
                 for ($i = $prevDepth; $i > $depth; $i--) {
168
-                    $ind = $indent . str_repeat('        ', $i);
167
+                    $ind = $indent.str_repeat('        ', $i);
169 168
                     //$html .= $ind . '    </li>' . PHP_EOL;
170
-                    $html .= $ind . '</' . $this->getTagname() . '>' . PHP_EOL;
169
+                    $html .= $ind.'</'.$this->getTagname().'>'.PHP_EOL;
171 170
                 }
172 171
                 // close previous li tag
173 172
                 //$html .= $myIndent . '    </li>' . PHP_EOL;
@@ -193,12 +192,12 @@  discard block
 block discarded – undo
193 192
             if ($addClassToListItem && $page->getClass()) {
194 193
                 $liClasses[] = $page->getClass();
195 194
             }
196
-            $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"';
195
+            $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"';
197 196
 
198 197
             $html .= /* $myIndent . '    <li' . $liClass . '>' . PHP_EOL
199
-                . */ $myIndent . '        ' . $this->htmlify($page, $escapeLabels, $addClassToListItem, [
200
-                    'data-test' => 'cta-toolbar-' . $this->slugify($page->getLabel()),
201
-                ]) . PHP_EOL;
198
+                . */ $myIndent.'        '.$this->htmlify($page, $escapeLabels, $addClassToListItem, [
199
+                    'data-test' => 'cta-toolbar-'.$this->slugify($page->getLabel()),
200
+                ]).PHP_EOL;
202 201
 
203 202
             // store as previous depth for next iteration
204 203
             $prevDepth = $depth;
@@ -206,10 +205,10 @@  discard block
 block discarded – undo
206 205
 
207 206
         if ($html) {
208 207
             // done iterating container; close open ul/li tags
209
-            for ($i = $prevDepth+1; $i > 0; $i--) {
210
-                $myIndent = $indent . str_repeat('        ', $i-1);
208
+            for ($i = $prevDepth + 1; $i > 0; $i--) {
209
+                $myIndent = $indent.str_repeat('        ', $i - 1);
211 210
                 $html .= /*$myIndent . '    </li>' . PHP_EOL
212
-                    . */ $myIndent . '</' . $this->getTagname() . '>' . PHP_EOL;
211
+                    . */ $myIndent.'</'.$this->getTagname().'>'.PHP_EOL;
213 212
             }
214 213
             $html = rtrim($html, PHP_EOL);
215 214
         }
@@ -232,7 +231,7 @@  discard block
 block discarded – undo
232 231
      * @param string $tagname
233 232
      */
234 233
     public function setTagname($tagname) {
235
-        if ( null !== $tagname ) {
234
+        if (null !== $tagname) {
236 235
             $this->tagname = $tagname;
237 236
         }
238 237
         return $this;
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Breadcrumbs.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -112,24 +112,24 @@  discard block
 block discarded – undo
112 112
         /** @var \Zend\View\Helper\EscapeHtml $escaper */
113 113
         $escaper = $this->view->plugin('escapeHtml');
114 114
         
115
-        $listHtmlOpen = '<ol class="'.$this->getOlClass().'" data-test="layout-breadcrumbs">' . PHP_EOL;
116
-        if ( !empty($this->getHeader()) ) {
117
-            $listHtmlOpen .= '<li class="' . $escaper($this->getHeaderClass()) . '" data-test="layout-breadcrumbs-header">' . $escaper($this->getHeader()) . '</li>' . PHP_EOL;
115
+        $listHtmlOpen = '<ol class="'.$this->getOlClass().'" data-test="layout-breadcrumbs">'.PHP_EOL;
116
+        if (!empty($this->getHeader())) {
117
+            $listHtmlOpen .= '<li class="'.$escaper($this->getHeaderClass()).'" data-test="layout-breadcrumbs-header">'.$escaper($this->getHeader()).'</li>'.PHP_EOL;
118 118
         }
119 119
         // put the deepest active page last in breadcrumbs
120 120
         if ($this->getLinkLast()) {
121
-            $html = '<li class="active" data-test="layout-breadcrumbs-current">' . $this->htmlify($active) . '</li>' . PHP_EOL;
121
+            $html = '<li class="active" data-test="layout-breadcrumbs-current">'.$this->htmlify($active).'</li>'.PHP_EOL;
122 122
         } else {
123
-            $html = '<li class="active" data-test="layout-breadcrumbs-current">' . $escaper(
123
+            $html = '<li class="active" data-test="layout-breadcrumbs-current">'.$escaper(
124 124
                 $this->translate($active->getLabel()) //, $active->getTextDomain())
125
-            ) . '</li>' . PHP_EOL;
125
+            ).'</li>'.PHP_EOL;
126 126
         }
127 127
 
128 128
         // walk back to root
129 129
         while ($parent = $active->getParent()) {
130 130
             if ($parent instanceof AbstractPage) {
131 131
                 // prepend crumb to html
132
-                $html = '<li data-test="layout-breadcrumbs-parent'.$parent->getLabel().'">' . $this->htmlify($parent) . '</li>' . PHP_EOL
132
+                $html = '<li data-test="layout-breadcrumbs-parent'.$parent->getLabel().'">'.$this->htmlify($parent).'</li>'.PHP_EOL
133 133
                     //. $this->getSeparator()
134 134
                     . $html;
135 135
             }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
             $active = $parent;
143 143
         }
144 144
 
145
-        $listHtmlClose = '</ol>' . PHP_EOL;
145
+        $listHtmlClose = '</ol>'.PHP_EOL;
146 146
         
147
-        return strlen($html) ? $listHtmlOpen . $this->getIndent() . $html . $listHtmlClose : '';
147
+        return strlen($html) ? $listHtmlOpen.$this->getIndent().$html.$listHtmlClose : '';
148 148
     }
149 149
 
150 150
     /**
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
             'class'  => $page->getClass(),
166 166
             'href'   => $page->getHref(),
167 167
             'target' => $page->getTarget(),
168
-            'data-test' => 'cta-breadcrumbs-' . $this->slugify($page->getLabel())
168
+            'data-test' => 'cta-breadcrumbs-'.$this->slugify($page->getLabel())
169 169
         ];
170 170
 
171 171
         /** @var \Zend\View\Helper\EscapeHtml $escaper */
172 172
         $escaper = $this->view->plugin('escapeHtml');
173 173
         $label   = $escaper($label);
174 174
 
175
-        return '<a' . $this->htmlAttribs($attribs) . '>' . $label . '</a>';
175
+        return '<a'.$this->htmlAttribs($attribs).'>'.$label.'</a>';
176 176
     }
177 177
     
178 178
     /**
Please login to merge, or discard this patch.
src/UIComponents/View/Helper/Traits/ComponentAttributesTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @return the $attribute 
37 37
      */
38 38
     public function getAttribute($name) {
39
-        return ( isset($this->attributes[$name]) ? $this->attributes[$name] : null );
39
+        return (isset($this->attributes[$name]) ? $this->attributes[$name] : null);
40 40
     }
41 41
 
42 42
     /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $value
47 47
      */
48 48
     public function setAttribute($attribute, $value = "") {
49
-        if ( null !== $attribute ) {
49
+        if (null !== $attribute) {
50 50
             $this->attributes[$attribute] = $value;
51 51
         }
52 52
         return $this;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @param array $attributes
68 68
      */
69 69
     public function setAttributes($attributes) {
70
-        if ( is_array($attributes) ) {
70
+        if (is_array($attributes)) {
71 71
             $this->attributes = array_merge_recursive($this->attributes, $attributes);
72 72
         }
73 73
         return $this;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         // except for "data-" and "aria-" attributes
89 89
         foreach ($attribs as $key => $value) {
90 90
             if ($value === null || (is_string($value) && !strlen($value))) {
91
-                if ( (strpos($key, "data") === false) && (strpos($key, "aria") === false) ) {
91
+                if ((strpos($key, "data") === false) && (strpos($key, "aria") === false)) {
92 92
                     unset($attribs[$key]);
93 93
                 }
94 94
             }
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
         $xhtml = '';
98 98
         $oView = $this->getView();
99
-        $escaper        = function ($val) { return $val; };
100
-        $escapeHtmlAttr = function ($val) { return $val; };
101
-        if ( ($oView instanceof \Zend\View\Renderer\RendererInterface) ) {
99
+        $escaper        = function($val) { return $val; };
100
+        $escapeHtmlAttr = function($val) { return $val; };
101
+        if (($oView instanceof \Zend\View\Renderer\RendererInterface)) {
102 102
             $escaper        = $oView->plugin('escapehtml');
103 103
             $escapeHtmlAttr = $oView->plugin('escapehtmlattr');
104 104
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         return $xhtml;
134 134
     }
135 135
 
136
-    public function slugify ($text) {
136
+    public function slugify($text) {
137 137
         $rules = <<<'RULES'
138 138
             :: Any-Latin;
139 139
             :: NFD;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         RULES;
148 148
 
149 149
         return \Transliterator::createFromRules($rules)
150
-            ->transliterate( $text );
150
+            ->transliterate($text);
151 151
     }
152 152
 
153 153
 }
Please login to merge, or discard this patch.