Test Failed
Push — master ( 8a12a1...341f45 )
by Björn
26:21 queued 06:45
created
module/Application/src/Application/Model/DbStructUpdater.php 5 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -215,6 +215,7 @@  discard block
 block discarded – undo
215 215
      *
216 216
     * @access private
217 217
     * @param  string $source and $dest are strings - database tables structures
218
+    * @param string $dest
218 219
     * @return array
219 220
     * - table (array)
220 221
     *        - destOrphan (boolean)
@@ -368,8 +369,8 @@  discard block
 block discarded – undo
368 369
     * returns array of fields or keys definitions that differs in the given tables structure
369 370
      *
370 371
     * @access private
371
-    * @param  sring $sourceSql table structure
372
-    * @param  sring $destSql   right table structure supports some $options
372
+    * @param  string $sourceSql table structure
373
+    * @param  string $destSql   right table structure supports some $options
373 374
     * supports some $options
374 375
     * @return array
375 376
     *     - [0]
@@ -703,6 +704,7 @@  discard block
 block discarded – undo
703 704
     /**
704 705
     * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from
705 706
     * the end of the string
707
+    * @param string $string
706 708
     */
707 709
     public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false)
708 710
     {
Please login to merge, or discard this patch.
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.
UIComponents/src/UIComponents/Factory/ComponentsControllerFactory.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      *
27 27
      * @param ServiceLocatorInterface $serviceLocator
28 28
      *
29
-     * @return mixed
29
+     * @return ComponentsController
30 30
      */
31 31
     public function createService(ServiceLocatorInterface $serviceLocator)
32 32
     {
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/Template/TemplateAbstract.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * in the static templates with dynamic data.
116 116
      *
117 117
      * @param $which String 's' for Static or else dynamic
118
-     * @param $needle String Placeholder
118
+     * @param string $needle String Placeholder
119 119
      * @param $replacement String Replacement String
120 120
      *
121 121
      * @return self
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     /**
140 140
      * Sets an encoding for the template's head block.
141 141
      *
142
-     * @param $encoding string Encoding to set
142
+     * @param string $encoding string Encoding to set
143 143
      * @return self
144 144
      */    
145 145
     public function setEncoding ($encoding)
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * Replaces a named function with the translated variant 
246 246
      * 
247 247
      * @param $template string Contents of the template to translate (it is reference to save memory!!!) 
248
-     * @param $functionName string Name of the translation function (e.g. i18n) 
248
+     * @param string $functionName string Name of the translation function (e.g. i18n) 
249 249
      * @return self
250 250
      */ 
251 251
     public function replacei18n(& $template, $functionName) { 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 abstract class TemplateAbstract implements TemplateInterface, TranslatorAwareInterface
26 26
 {
27
-	use TranslatorAwareInterfaceTrait;
27
+    use TranslatorAwareInterfaceTrait;
28 28
 
29 29
     /**
30 30
      * Needles (static)
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * 
78 78
      * @param array $tags
79 79
      * @param \Zend\I18n\Translator\TranslatorInterface $translator
80
-	 * @return \UIComponents\Template\TemplateAbstract
80
+     * @return \UIComponents\Template\TemplateAbstract
81 81
      */
82 82
     public function __construct ($tags = false, $translator = null)
83 83
     {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
      * Needles (static)
31 31
      * @var array
32 32
      */
33
-    public $needles = array ();
33
+    public $needles = array();
34 34
 
35 35
     /**
36 36
      * Replacements (static)
37 37
      * @var array
38 38
      */
39
-    public $replacements = array ();
39
+    public $replacements = array();
40 40
 
41 41
     /**
42 42
      * dynamicNeedles (dynamic)
43 43
      * @var array
44 44
      */
45
-    public $dynamicNeedles = array ();
45
+    public $dynamicNeedles = array();
46 46
 
47 47
     /**
48 48
      * dynamicReplacements (dynamic)
49 49
      * @var array
50 50
      */
51
-    public $dynamicReplacements = array ();
51
+    public $dynamicReplacements = array();
52 52
 
53 53
     /**
54 54
      * Dynamic counter
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * Tags array (for dynamic blocks);
61 61
      * @var array
62 62
      */
63
-    public $tags = array (
63
+    public $tags = array(
64 64
         'static' => '{%s}', 
65 65
         'start' => '<!-- BEGIN:BLOCK -->', 
66 66
         'end' => '<!-- END:BLOCK -->'
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param \Zend\I18n\Translator\TranslatorInterface $translator
80 80
 	 * @return \UIComponents\Template\TemplateAbstract
81 81
      */
82
-    public function __construct ($tags = false, $translator = null)
82
+    public function __construct($tags = false, $translator = null)
83 83
     {
84 84
         if (is_array($tags))
85 85
         {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param $sDomain    string    Sets the domain to use for template translations
103 103
      * @return self
104 104
      */    
105
-    public function setDomain ($sDomain)
105
+    public function setDomain($sDomain)
106 106
     {
107 107
         $this->_sDomain = $sDomain;
108 108
         return $this;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param $encoding string Encoding to set
143 143
      * @return self
144 144
      */    
145
-    public function setEncoding ($encoding)
145
+    public function setEncoding($encoding)
146 146
     {
147 147
         $this->_encoding = $encoding;
148 148
         return $this;
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
     public function reset()
168 168
     {
169 169
         $this->dynamicContent = 0;
170
-        $this->needles = array ();
171
-        $this->replacements = array ();
172
-        $this->dynamicNeedles = array ();
173
-        $this->dynamicReplacements = array ();
170
+        $this->needles = array();
171
+        $this->replacements = array();
172
+        $this->dynamicNeedles = array();
173
+        $this->dynamicReplacements = array();
174 174
         return $this;
175 175
     }
176 176
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             unset ($pieces[0][0]); 
216 216
 
217 217
             //generate dynamic blocks 
218
-            for ($a = 0; $a < $this->dynamicContent; $a ++) { 
218
+            for ($a = 0; $a < $this->dynamicContent; $a++) { 
219 219
                 $content .= str_replace($this->dynamicNeedles[$a], $this->dynamicReplacements[$a], $pieces[1][0]); 
220 220
             } 
221 221
             unset ($pieces[1][0]); 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         
230 230
         if ($this->_encoding != "")
231 231
         {
232
-            $content = '<meta http-equiv="Content-Type" content="text/html; charset=' . $this->_encoding . '">' . "\n" . $content;
232
+            $content = '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".$content;
233 233
             //$content = str_replace("</head>", '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".'</head>', $content);
234 234
         }
235 235
           
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
 
253 253
         // Be sure that php code stays unchanged 
254 254
         $php_matches = array();
255
-        $container     = array();
255
+        $container = array();
256 256
         if (preg_match_all('/<\?(php)?((.)|(\s))*?\?>/i', $template, $php_matches)) { 
257 257
             $x = 0; 
258 258
             foreach ($php_matches[0] as $php_match) { 
259 259
                 $x++; 
260
-                $template = str_replace ($php_match , "{PHP#".$x."#PHP}", $template); 
260
+                $template = str_replace($php_match, "{PHP#".$x."#PHP}", $template); 
261 261
                 $container[$x] = $php_match; 
262 262
             }
263 263
         }
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
         preg_match_all("/".preg_quote($functionName, "/")."\\(([\\\"\\'])(.*?)\\1\\)/s", $template, $matches); 
268 268
 
269 269
         $matches = array_values(array_unique($matches[2])); 
270
-        for ($a = 0; $a < count($matches); $a ++) { 
270
+        for ($a = 0; $a < count($matches); $a++) { 
271 271
             $template = preg_replace("/".preg_quote($functionName, "/")."\\([\\\"\\']".preg_quote($matches[$a], "/")."[\\\"\\']\\)/s", $this->translate($matches[$a], $this->_sDomain), $template);
272 272
         } 
273 273
 
274 274
         // Change back php placeholder 
275 275
         if (is_array($container)) { 
276 276
             foreach ($container as $x => $php_match) { 
277
-                $template = str_replace ("{PHP#".$x."#PHP}" , $php_match, $template); 
277
+                $template = str_replace("{PHP#".$x."#PHP}", $php_match, $template); 
278 278
             } 
279 279
         }
280 280
         return $this;
Please login to merge, or discard this 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/AbstractHelper.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -385,7 +385,7 @@
 block discarded – undo
385 385
     /**
386 386
      * get DOM object
387 387
      * 
388
-     * @return the $_DOMDoc
388
+     * @return \DOMDocument $_DOMDoc
389 389
      */
390 390
     public function getDOMDoc() {
391 391
         if ( ! $this->_DOMDoc instanceof \DOMDocument ) {
Please login to merge, or discard this patch.
Unused Use Statements   -6 removed lines patch added patch discarded remove patch
@@ -15,16 +15,10 @@
 block discarded – undo
15 15
 
16 16
 namespace UIComponents\View\Helper;
17 17
 
18
-use RecursiveIteratorIterator;
19
-use Zend\EventManager\EventManager;
20 18
 use Zend\EventManager\EventManagerAwareInterface;
21
-use Zend\EventManager\EventManagerInterface;
22 19
 use Zend\I18n\Translator\TranslatorAwareInterface;
23 20
 use Zend\Navigation\Page\AbstractPage;
24
-use Zend\Navigation\AbstractContainer;
25
-use Zend\Permissions\Acl;
26 21
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
27
-use Zend\ServiceManager\ServiceLocatorInterface;
28 22
 use Zend\View;
29 23
 use Zend\View\Exception;
30 24
 use \UIComponents\Translator\TranslatorAwareInterfaceTrait;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
     
103 103
     
104 104
 
105
-   /**
105
+    /**
106 106
      * Magic overload: Proxy calls to the navigation container
107 107
      *
108 108
      * @param    string $method    method name in container
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             
152 152
         } catch (\Exception $e) {
153 153
             
154
-            $msg = get_class($e) . ': ' . $e->getMessage() . "\n" . $e->getTraceAsString();
154
+            $msg = get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString();
155 155
             trigger_error($msg, E_USER_ERROR);
156 156
             return '';
157 157
             
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
         /** @var \Zend\View\Helper\EscapeHtml $escaper */
196 196
         $escaper = $this->view->plugin('escapeHtml');
197
-        $label    = $escaper($label);
197
+        $label = $escaper($label);
198 198
 
199
-        return '<a' . $this->htmlAttribs($attribs) . '>' . $label . '</a>';
199
+        return '<a'.$this->htmlAttribs($attribs).'>'.$label.'</a>';
200 200
     }
201 201
 
202 202
     /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $prefix = get_class($this);
213 213
         $prefix = strtolower(trim(substr($prefix, strrpos($prefix, '\\')), '\\'));
214 214
 
215
-        return $prefix . '-' . $value;
215
+        return $prefix.'-'.$value;
216 216
     }
217 217
 
218 218
     //
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function buildComponent() {
226 226
         $html = ' '.__CLASS__.' ';
227
-        if ( empty($this->getTagname()) ) {
227
+        if (empty($this->getTagname())) {
228 228
             return '';
229 229
         }
230 230
         
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
         $body = $this->getContent();
236 236
         
237 237
         $content = (array($header, $body, $footer));
238
-        if ( is_array($body) && !isset($body["tagname"])) {
238
+        if (is_array($body) && !isset($body["tagname"])) {
239 239
             $content = array_merge(array($header), ($body), array($footer));
240 240
         }
241 241
         
242
-        $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array)$this->getAttributes(), $content);
242
+        $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array) $this->getAttributes(), $content);
243 243
 
244 244
         return $component;
245 245
 
@@ -259,29 +259,29 @@  discard block
 block discarded – undo
259 259
         $html = '';
260 260
         $html .= '<'.$tagname.''.((isset($classnames) && !empty($classnames)) ? ' class="'.$classnames.'"' : '').' '.$this->htmlAttribs($attributes).'>';
261 261
         if (!empty($content)) {
262
-            if ( $content instanceof AbstractHelper ) {
262
+            if ($content instanceof AbstractHelper) {
263 263
                 $html .= $content->render();
264
-            } else if ( is_array($content) && isset($content['tagname']) ) {
264
+            } else if (is_array($content) && isset($content['tagname'])) {
265 265
                 $html .= $this->_createElement(
266 266
                     $content['tagname'],
267 267
                     (isset($content['classnames']) && !empty($content['classnames']) ? $content['classnames'] : (isset($content['class']) && !empty($content['class']) ? $content['class'] : '')),
268 268
                     (isset($content['attributes']) && !empty($content['attributes']) ? $content['attributes'] : (isset($content['attr']) && !empty($content['attr']) ? $content['attr'] : '')),
269 269
                     (isset($content['content']) && !empty($content['content']) ? $content['content'] : '')
270 270
                 );
271
-            } else if ( is_array($content) ) {
271
+            } else if (is_array($content)) {
272 272
                 foreach ($content as $key => $item) {
273
-                    if ( $item instanceof AbstractHelper ) {
273
+                    if ($item instanceof AbstractHelper) {
274 274
                         $html .= $item->render();
275
-                    } else if ( is_array($item) && isset($item['tagname']) ) {
275
+                    } else if (is_array($item) && isset($item['tagname'])) {
276 276
                         $html .= $this->_createElement(
277 277
                             $item['tagname'],
278 278
                             (isset($item['classnames']) && !empty($item['classnames']) ? $item['classnames'] : (isset($item['class']) && !empty($item['class']) ? $item['class'] : '')),
279
-                            (array)(isset($item['attributes']) && !empty($item['attributes']) ? $item['attributes'] : (isset($item['attr']) && !empty($item['attr']) ? $item['attr'] : '')),
279
+                            (array) (isset($item['attributes']) && !empty($item['attributes']) ? $item['attributes'] : (isset($item['attr']) && !empty($item['attr']) ? $item['attr'] : '')),
280 280
                             (isset($item['content']) && !empty($item['content']) ? $item['content'] : '')
281 281
                         );
282
-                    } else if ( is_array($item) ) {
282
+                    } else if (is_array($item)) {
283 283
                         foreach ($content as $key => $value) {
284
-                            $html .= (string)$value;
284
+                            $html .= (string) $value;
285 285
                         }
286 286
                     } else {
287 287
                         $html .= $item;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @param string $tagname
317 317
      */
318 318
     public function setTagname($tagname) {
319
-        if ( null !== $tagname ) {
319
+        if (null !== $tagname) {
320 320
             $this->tagname = $tagname;
321 321
         }
322 322
         return $this;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
      * @param mixed $header
338 338
      */
339 339
     public function setHeader($header) {
340
-        if ( null !== $header ) {
340
+        if (null !== $header) {
341 341
             $this->header = $header;
342 342
         }
343 343
         return $this;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      * @param mixed $footer
359 359
      */
360 360
     public function setFooter($footer = null) {
361
-        if ( null !== $footer ) {
361
+        if (null !== $footer) {
362 362
             $this->footer = $footer;
363 363
         }
364 364
         return $this;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @return the $_DOMDoc
389 389
      */
390 390
     public function getDOMDoc() {
391
-        if ( ! $this->_DOMDoc instanceof \DOMDocument ) {
391
+        if (!$this->_DOMDoc instanceof \DOMDocument) {
392 392
             $this->_DOMDoc = new \DOMDocument();
393 393
         }
394 394
         return $this->_DOMDoc;
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/AbstractProxyHelper.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * Sets the default proxy to use in {@link render()}
265 265
      *
266 266
      * @param  string $proxy default proxy
267
-     * @return Bootstrap
267
+     * @return AbstractProxyHelper
268 268
      */
269 269
     public function setDefaultProxy($proxy)
270 270
     {
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * Sets whether container should be injected when proxying
287 287
      *
288 288
      * @param  bool $injectContainer
289
-     * @return Bootstrap
289
+     * @return AbstractProxyHelper
290 290
      */
291 291
     public function setInjectContainer($injectContainer = true)
292 292
     {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * Sets whether ACL should be injected when proxying
309 309
      *
310 310
      * @param  bool $injectAcl
311
-     * @return NavigBootstrapation
311
+     * @return AbstractProxyHelper
312 312
      */
313 313
     public function setInjectAcl($injectAcl = true)
314 314
     {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * Sets whether translator should be injected when proxying
331 331
      *
332 332
      * @param  bool $injectTranslator
333
-     * @return Bootstrap
333
+     * @return AbstractProxyHelper
334 334
      */
335 335
     public function setInjectTranslator($injectTranslator = true)
336 336
     {
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -235,29 +235,29 @@
 block discarded – undo
235 235
      */
236 236
     protected function inject(\Zend\View\Helper\AbstractHelper $helper)
237 237
     {
238
-		if ( 
239
-			($helper instanceof \UIComponents\View\Helper\AbstractHelper) ||
240
-			($helper instanceof \UIComponents\View\Helper\Navigation\Menu) 
241
-		) {
242
-	        if ($this->getInjectContainer() && !$helper->hasContainer()) {
243
-	            $helper->setContainer($this->getContainer());
244
-	        }
238
+        if ( 
239
+            ($helper instanceof \UIComponents\View\Helper\AbstractHelper) ||
240
+            ($helper instanceof \UIComponents\View\Helper\Navigation\Menu) 
241
+        ) {
242
+            if ($this->getInjectContainer() && !$helper->hasContainer()) {
243
+                $helper->setContainer($this->getContainer());
244
+            }
245 245
 	
246
-	        if ($this->getInjectAcl()) {
247
-	            if (!$helper->hasAcl()) {
248
-	                $helper->setAcl($this->getAcl());
249
-	            }
250
-	            if (!$helper->hasRole()) {
251
-	                $helper->setRole($this->getRole());
252
-	            }
253
-	        }
254
-	        if ($this->getInjectTranslator() && !$helper->hasTranslator()) {
255
-	            $helper->setTranslator(
256
-	                $this->getTranslator(),
257
-	                $this->getTranslatorTextDomain()
258
-	            );
259
-	        }
260
-		}
246
+            if ($this->getInjectAcl()) {
247
+                if (!$helper->hasAcl()) {
248
+                    $helper->setAcl($this->getAcl());
249
+                }
250
+                if (!$helper->hasRole()) {
251
+                    $helper->setRole($this->getRole());
252
+                }
253
+            }
254
+            if ($this->getInjectTranslator() && !$helper->hasTranslator()) {
255
+                $helper->setTranslator(
256
+                    $this->getTranslator(),
257
+                    $this->getTranslatorTextDomain()
258
+                );
259
+            }
260
+        }
261 261
     }
262 262
 
263 263
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,12 +205,12 @@
 block discarded – undo
205 205
             return false;
206 206
         }
207 207
 
208
-        $helper    = $plugins->get($proxy);
208
+        $helper = $plugins->get($proxy);
209 209
 
210 210
         if ($helper && ($helper instanceof \Zend\View\Helper\Navigation\Menu)) {
211 211
             
212 212
             $container = $this->getContainer();
213
-            $hash      = spl_object_hash($container) . spl_object_hash($helper);
213
+            $hash      = spl_object_hash($container).spl_object_hash($helper);
214 214
             if (!isset($this->injected[$hash])) {
215 215
                 $helper->setContainer();
216 216
                 $this->inject($helper);
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
     /**
33 33
      * Helper entry point
34 34
      *
35
-     * @param  string|AbstractContainer $container container to operate on
36 35
      * @return Components
37 36
      */
38 37
     public function __invoke($options = array())
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Breadcrumbs.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     }
147 147
     
148 148
     /**
149
-     * @return the $olClass
149
+     * @return string $olClass
150 150
      */
151 151
     public function getOlClass() {
152 152
         return $this->olClass;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     }
164 164
 
165 165
     /**
166
-     * @return the $liClass
166
+     * @return string $liClass
167 167
      */
168 168
     public function getLiClass() {
169 169
         return $this->liClass;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     }
181 181
     
182 182
     /**
183
-     * @return the $noList
183
+     * @return boolean $noList
184 184
      */
185 185
     public function getNoList() {
186 186
         return $this->noList;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
     
199 199
     /**
200
-     * @return the $header
200
+     * @return string $header
201 201
      */
202 202
     public function getHeader() {
203 203
         return $this->header;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     }
215 215
     
216 216
     /**
217
-     * @return the $headerClass
217
+     * @return string $headerClass
218 218
      */
219 219
     public function getHeaderClass() {
220 220
         return $this->headerClass;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -110,24 +110,24 @@  discard block
 block discarded – undo
110 110
         /** @var \Zend\View\Helper\EscapeHtml $escaper */
111 111
         $escaper = $this->view->plugin('escapeHtml');
112 112
         
113
-        $listHtmlOpen = '<ol class="'.$this->getOlClass().'">' . PHP_EOL;
114
-        if ( !empty($this->getHeader()) ) {
115
-            $listHtmlOpen .= '<li class="' . $escaper($this->getHeaderClass()) . '">' . $escaper($this->getHeader()) . '</li>' . PHP_EOL;
113
+        $listHtmlOpen = '<ol class="'.$this->getOlClass().'">'.PHP_EOL;
114
+        if (!empty($this->getHeader())) {
115
+            $listHtmlOpen .= '<li class="'.$escaper($this->getHeaderClass()).'">'.$escaper($this->getHeader()).'</li>'.PHP_EOL;
116 116
         }
117 117
         // put the deepest active page last in breadcrumbs
118 118
         if ($this->getLinkLast()) {
119
-            $html = '<li class="active">' . $this->htmlify($active) . '</li>' . PHP_EOL;
119
+            $html = '<li class="active">'.$this->htmlify($active).'</li>'.PHP_EOL;
120 120
         } else {
121
-            $html    = '<li class="active">' . $escaper(
121
+            $html = '<li class="active">'.$escaper(
122 122
                 $this->translate($active->getLabel()) //, $active->getTextDomain())
123
-            ) . '</li>' . PHP_EOL;
123
+            ).'</li>'.PHP_EOL;
124 124
         }
125 125
 
126 126
         // walk back to root
127 127
         while ($parent = $active->getParent()) {
128 128
             if ($parent instanceof AbstractPage) {
129 129
                 // prepend crumb to html
130
-                $html = '<li>' . $this->htmlify($parent) . '</li>' . PHP_EOL
130
+                $html = '<li>'.$this->htmlify($parent).'</li>'.PHP_EOL
131 131
                     //. $this->getSeparator()
132 132
                     . $html;
133 133
             }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
             $active = $parent;
141 141
         }
142 142
 
143
-        $listHtmlClose = '</ol>' . PHP_EOL;
143
+        $listHtmlClose = '</ol>'.PHP_EOL;
144 144
         
145
-        return strlen($html) ? $listHtmlOpen . $this->getIndent() . $html . $listHtmlClose : '';
145
+        return strlen($html) ? $listHtmlOpen.$this->getIndent().$html.$listHtmlClose : '';
146 146
     }
147 147
     
148 148
     /**
Please login to merge, or discard this patch.
module/UIComponents/src/UIComponents/View/Helper/Components/Button.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     
175 175
     
176 176
     /**
177
-     * @return the $drop
177
+     * @return boolean $drop
178 178
      */
179 179
     public function getDrop() {
180 180
         return $this->drop;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     }
192 192
 
193 193
     /**
194
-     * @return the $block
194
+     * @return boolean $block
195 195
      */
196 196
     public function getBlock() {
197 197
         return $this->block;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-     * @return the $active
209
+     * @return boolean $active
210 210
      */
211 211
     public function getActive() {
212 212
         return $this->active;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
     
33 33
     protected $active = false;
34 34
     
35
-    protected $_tags = array('a','input','button');
35
+    protected $_tags = array('a', 'input', 'button');
36 36
     
37
-    protected $_sizes = array('xs','sm','lg');
37
+    protected $_sizes = array('xs', 'sm', 'lg');
38 38
     protected $_foundations_sizes = array(
39 39
         'xs' => 'tiny', 'xs' => 'small', 'lg' => 'large',
40 40
     );
41 41
 
42
-    protected $_types = array('default','primary','success','info','warning','alert','danger','link');
42
+    protected $_types = array('default', 'primary', 'success', 'info', 'warning', 'alert', 'danger', 'link');
43 43
     
44 44
     /**
45 45
      * View helper entry point:
@@ -57,31 +57,31 @@  discard block
 block discarded – undo
57 57
         $component->setHeader('')->setFooter('');
58 58
         
59 59
         // tag options
60
-        if ( isset($options["tagname"]) && in_array(strtolower($options["tagname"]), $component->getTags()) ) {
60
+        if (isset($options["tagname"]) && in_array(strtolower($options["tagname"]), $component->getTags())) {
61 61
             $component->setTagname(strtolower($options["tagname"]));
62 62
         } else {
63 63
             $component->setTagname('a');
64 64
         }
65
-        if ( isset($options["attributes"]) && is_array($options["attributes"]) ) {
65
+        if (isset($options["attributes"]) && is_array($options["attributes"])) {
66 66
             $component->setAttributes($options["attributes"]);
67 67
         }
68 68
         
69 69
         // bootstrap options
70
-        if ( isset($options["size"]) && in_array(strtolower($options["size"]), $component->getSizes()) ) {
70
+        if (isset($options["size"]) && in_array(strtolower($options["size"]), $component->getSizes())) {
71 71
             $component->addClass('btn-'.strtolower($options["size"]).' '.strtolower($this->_foundations_sizes["size"]));
72 72
         }
73
-        if ( isset($options["type"]) && in_array(strtolower($options["type"]), $component->getTypes()) ) {
73
+        if (isset($options["type"]) && in_array(strtolower($options["type"]), $component->getTypes())) {
74 74
             $component->addClass('btn-'.strtolower($options["type"]).' '.strtolower($options["type"]));
75 75
         } else {
76 76
             $component->addClass('btn-default');
77 77
         }
78
-        if ( isset($options["drop"]) ) {
78
+        if (isset($options["drop"])) {
79 79
             $component->setDrop($options["drop"]);
80 80
         }
81
-        if ( isset($options["block"]) ) {
81
+        if (isset($options["block"])) {
82 82
             $component->setBlock($options["block"]);
83 83
         }
84
-        if ( isset($options["active"]) ) {
84
+        if (isset($options["active"])) {
85 85
             $component->setActive($options["active"]);
86 86
         }
87 87
 
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
             $component->setAttributes(array_merge_recursive($component->getAttributes(), array(
93 93
                 'role' => 'button'
94 94
             )));
95
-            if ( isset($options["disabled"]) ) {
95
+            if (isset($options["disabled"])) {
96 96
                 $component->addClass('disabled');
97 97
             }
98 98
         } else {
99 99
             $component->setAttributes(array_merge_recursive($component->getAttributes(), array(
100 100
                 'type' => 'button'
101 101
             )));
102
-            if ( isset($options["disabled"]) ) {
102
+            if (isset($options["disabled"])) {
103 103
                 $component->setAttributes(array_merge_recursive($component->getAttributes(), array(
104 104
                     'disabled' => 'disabled'
105 105
                 )));
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
         }
108 108
         
109 109
         // tag content
110
-        if ( isset($options["label"]) && !empty($options["label"]) ) {
110
+        if (isset($options["label"]) && !empty($options["label"])) {
111 111
             $component->setContent($options["label"]);
112
-        } else if ( isset($options["content"]) && !empty($options["content"]) ) {
112
+        } else if (isset($options["content"]) && !empty($options["content"])) {
113 113
             $component->setContent($options["content"]);
114 114
         }
115 115
         
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param string $drop
185 185
      */
186 186
     public function setDrop($drop) {
187
-        if ( in_array(strtolower($drop), array('up','down'))) {
187
+        if (in_array(strtolower($drop), array('up', 'down'))) {
188 188
             $this->drop = $drop;
189 189
         }
190 190
         return $this;
Please login to merge, or discard this 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/UIComponents/src/UIComponents/View/Helper/Components/Buttongroup.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     }
96 96
 
97 97
     /**
98
-     * @return the $block
98
+     * @return boolean $block
99 99
      */
100 100
     public function getBlock() {
101 101
         return $this->block;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     
29 29
     protected $block = false;
30 30
     
31
-    protected $_sizes = array('default','xs','sm','lg');
31
+    protected $_sizes = array('default', 'xs', 'sm', 'lg');
32 32
     protected $_foundations_sizes = array(
33 33
         'xs' => 'tiny', 'xs' => 'small', 'lg' => 'large', 'default' => '',
34 34
     );
@@ -47,32 +47,32 @@  discard block
 block discarded – undo
47 47
         
48 48
         $this->setHeader('')->setFooter('');
49 49
 
50
-        if ( isset($options["attributes"]) && is_array($options["attributes"]) ) {
50
+        if (isset($options["attributes"]) && is_array($options["attributes"])) {
51 51
             $component->setAttributes($options["attributes"]);
52 52
         }
53 53
         $component->setAttributes(array_merge_recursive($component->getAttributes(), array(
54 54
             'role' => 'group'
55 55
         )));
56 56
         
57
-        if ( isset($options["vertical"]) && !!$options["vertical"] ) {
57
+        if (isset($options["vertical"]) && !!$options["vertical"]) {
58 58
             $component->setClassnames('btn-group-vertical vertical');
59
-        } else if ( isset($options["justified"]) && !!$options["justified"] ) {
59
+        } else if (isset($options["justified"]) && !!$options["justified"]) {
60 60
             $component->addClass('btn-group-justified');
61 61
         }
62 62
         
63
-        if ( isset($options["size"]) && in_array($options["size"], $component->getSizes()) ) {
63
+        if (isset($options["size"]) && in_array($options["size"], $component->getSizes())) {
64 64
             $component->addClass('btn-group-'.$options["size"].' '.strtolower($this->_foundations_sizes["size"]));
65 65
         }
66
-        if ( isset($options["block"]) ) {
66
+        if (isset($options["block"])) {
67 67
             $component->setBlock($options["block"]);
68 68
         }
69 69
         if ($component->getBlock()) $component->addClass('btn-block expanded');
70 70
         
71 71
         
72 72
         
73
-        if ( isset($options["buttons"]) && !empty($options["buttons"]) ) {
73
+        if (isset($options["buttons"]) && !empty($options["buttons"])) {
74 74
             $component->setContent($options["buttons"]);
75
-        } else if ( isset($options["content"]) && !empty($options["content"]) ) {
75
+        } else if (isset($options["content"]) && !empty($options["content"])) {
76 76
             $component->setContent($options["content"]);
77 77
         }
78 78
 
Please login to merge, or discard this 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.