Test Failed
Pull Request — master (#3)
by
unknown
05:25 queued 03:49
created
module/UIComponents/src/UIComponents/Template/TemplateAbstract.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -189,8 +189,7 @@  discard block
 block discarded – undo
189 189
         if (!@ is_file($template))
190 190
         {
191 191
             $content = & $template; //template is a string (it is a reference to save memory!!!)
192
-        }
193
-        else
192
+        } else
194 193
         {
195 194
             $content = implode("", file($template)); //template is a file
196 195
         }
@@ -233,10 +232,11 @@  discard block
 block discarded – undo
233 232
             //$content = str_replace("</head>", '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".'</head>', $content);
234 233
         }
235 234
           
236
-        if ($return)
237
-            return $content;
238
-        else
239
-            echo $content;
235
+        if ($return) {
236
+                    return $content;
237
+        } else {
238
+                    echo $content;
239
+        }
240 240
     }
241 241
 
242 242
     /** 
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Buttongroup.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@
 block discarded – undo
66 66
         if ( isset($options["block"]) ) {
67 67
             $component->setBlock($options["block"]);
68 68
         }
69
-        if ($component->getBlock()) $component->addClass('btn-block expanded');
69
+        if ($component->getBlock()) {
70
+            $component->addClass('btn-block expanded');
71
+        }
70 72
         
71 73
         
72 74
         
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Button.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,12 @@
 block discarded – undo
85 85
             $component->setActive($options["active"]);
86 86
         }
87 87
 
88
-        if ($component->getBlock()) $component->addClass('btn-block expanded');
89
-        if ($component->getActive()) $component->addClass('active');
88
+        if ($component->getBlock()) {
89
+            $component->addClass('btn-block expanded');
90
+        }
91
+        if ($component->getActive()) {
92
+            $component->addClass('active');
93
+        }
90 94
         
91 95
         if ($component->getTagname() == 'a') {
92 96
             $component->setAttributes(array_merge_recursive($component->getAttributes(), array(
Please login to merge, or discard this patch.
module/Application/src/Application/Model/DbStructUpdater.php 1 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.