Passed
Push — master ( c49a71...1dce7e )
by Sebastian
04:29
created
src/NumberInfo.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
         return $this;
84 84
     }
85 85
     
86
-   /**
87
-    * Retrieves the raw, internal information array resulting
88
-    * from the parsing of the number.
89
-    *  
90
-    * @return array
91
-    */
86
+    /**
87
+     * Retrieves the raw, internal information array resulting
88
+     * from the parsing of the number.
89
+     *  
90
+     * @return array
91
+     */
92 92
     public function getRawInfo()
93 93
     {
94 94
         return $this->info;
@@ -576,39 +576,39 @@  discard block
 block discarded – undo
576 576
     
577 577
     protected $postProcess = false;
578 578
     
579
-   /**
580
-    * Called if explicitly enabled: allows filtering the 
581
-    * number after the detection process has completed.
582
-    * 
583
-    * @param mixed $number The adjusted number
584
-    * @param string $originalString The original value before it was parsed
585
-    * @return mixed
586
-    */
579
+    /**
580
+     * Called if explicitly enabled: allows filtering the 
581
+     * number after the detection process has completed.
582
+     * 
583
+     * @param mixed $number The adjusted number
584
+     * @param string $originalString The original value before it was parsed
585
+     * @return mixed
586
+     */
587 587
     protected function postProcess($number, $originalString)
588 588
     {
589 589
         return $number;
590 590
     }
591 591
     
592
-   /**
593
-    * Filters the value before it is parsed, but only if it is a string.
594
-    * 
595
-    * @param string $string
596
-    * @param array $cache
597
-    * @return mixed
598
-    */
592
+    /**
593
+     * Filters the value before it is parsed, but only if it is a string.
594
+     * 
595
+     * @param string $string
596
+     * @param array $cache
597
+     * @return mixed
598
+     */
599 599
     protected function preProcess(string $string, &$cache, $value)
600 600
     {
601 601
         return str_replace(',', '.', $string);
602 602
     }
603 603
     
604
-   /**
605
-    * Enables the post processing so the postProcess method gets called.
606
-    * This should be called in the {@link NumberInfo::preProcess()}
607
-    * method as needed.
608
-    * 
609
-    * @return NumberInfo
610
-    * @see NumberInfo::postProcess()
611
-    */
604
+    /**
605
+     * Enables the post processing so the postProcess method gets called.
606
+     * This should be called in the {@link NumberInfo::preProcess()}
607
+     * method as needed.
608
+     * 
609
+     * @return NumberInfo
610
+     * @see NumberInfo::postProcess()
611
+     */
612 612
     protected function enablePostProcess() : NumberInfo
613 613
     {
614 614
         $this->postProcess = true;
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function setValue($value)
74 74
     {
75
-        if($value instanceof NumberInfo) {
75
+        if ($value instanceof NumberInfo) {
76 76
             $value = $value->getValue();
77 77
         }
78 78
         
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     
106 106
     public function isPositive()
107 107
     {
108
-        if(!$this->isEmpty()) {
108
+        if (!$this->isEmpty()) {
109 109
             $number = $this->getNumber();
110 110
             return $number > 0;
111 111
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function hasValue()
138 138
     {
139
-        if(!$this->isEmpty() && !$this->isZero()) {
139
+        if (!$this->isEmpty() && !$this->isZero()) {
140 140
             return true;
141 141
         }
142 142
         
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function getUnits()
211 211
     {
212
-        if(!$this->hasUnits()) {
212
+        if (!$this->hasUnits()) {
213 213
             return 'px';
214 214
         }
215 215
         
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function toAttribute()
245 245
     {
246
-        if($this->isEmpty()) {
246
+        if ($this->isEmpty()) {
247 247
             return null;
248 248
         }
249 249
         
250
-        if($this->isZero()) {
250
+        if ($this->isZero()) {
251 251
             return '0';
252 252
         }
253 253
         
254
-        if($this->isPercent()) {
254
+        if ($this->isPercent()) {
255 255
             return $this->getNumber().$this->getUnits();
256 256
         }
257 257
         
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function toCSS()
266 266
     {
267
-        if($this->isEmpty()) {
267
+        if ($this->isEmpty()) {
268 268
             return null;
269 269
         }
270 270
         
271
-        if($this->isZero()) {
271
+        if ($this->isZero()) {
272 272
             return '0';
273 273
         }
274 274
         
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     
278 278
     public function __toString()
279 279
     {
280
-        if($this->isEmpty()) {
280
+        if ($this->isEmpty()) {
281 281
             return '';
282 282
         }
283 283
         
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     public function isBiggerThan($number)
296 296
     {
297 297
         $number = parseNumber($number);
298
-        if($number->getUnits() != $this->getUnits()) {
298
+        if ($number->getUnits() != $this->getUnits()) {
299 299
             return false;
300 300
         }
301 301
         
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     public function isSmallerThan($number)
314 314
     {
315 315
         $number = parseNumber($number);
316
-        if($number->getUnits() != $this->getUnits()) {
316
+        if ($number->getUnits() != $this->getUnits()) {
317 317
             return false;
318 318
         }
319 319
         
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     public function isBiggerEqual($number)
324 324
     {
325 325
         $number = parseNumber($number);
326
-        if($number->getUnits() != $this->getUnits()) {
326
+        if ($number->getUnits() != $this->getUnits()) {
327 327
             return false;
328 328
         }
329 329
         
@@ -340,14 +340,14 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function add($value)
342 342
     {
343
-        if($this->isEmpty()) {
343
+        if ($this->isEmpty()) {
344 344
             $this->setValue($value);
345 345
             return $this;
346 346
         }
347 347
         
348 348
         $number = parseNumber($value);
349 349
         
350
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
350
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
351 351
         {
352 352
             $new = $this->getNumber() + $number->getNumber();
353 353
             $this->setValue($new.$this->getUnits());
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function subtract($value)
368 368
     {
369
-        if($this->isEmpty()) {
369
+        if ($this->isEmpty()) {
370 370
             $this->setValue($value);
371 371
             return $this;
372 372
         }
373 373
         
374 374
         $number = parseNumber($value);
375 375
         
376
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
376
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
377 377
         {
378 378
             $new = $this->getNumber() - $number->getNumber();
379 379
             $this->setValue($new.$this->getUnits());
@@ -400,25 +400,25 @@  discard block
 block discarded – undo
400 400
     
401 401
     protected function percentOperation($operation, $percent)
402 402
     {
403
-        if($this->isZeroOrEmpty()) {
403
+        if ($this->isZeroOrEmpty()) {
404 404
             return $this;
405 405
         }
406 406
         
407 407
         $percent = parseNumber($percent);
408
-        if($percent->hasUnits() && !$percent->isPercent()) {
408
+        if ($percent->hasUnits() && !$percent->isPercent()) {
409 409
             return $this;
410 410
         }
411 411
         
412 412
         $number = $this->getNumber();
413 413
         $value = $number * $percent->getNumber() / 100;
414 414
         
415
-        if($operation == '-') {
415
+        if ($operation == '-') {
416 416
             $number = $number - $value;
417 417
         } else {
418 418
             $number = $number + $value;
419 419
         }
420 420
         
421
-        if($this->isUnitInteger()) {
421
+        if ($this->isUnitInteger()) {
422 422
             $number = intval($number);
423 423
         }
424 424
         
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
         
470 470
         $this->restoreFilters = false;
471 471
         
472
-        if(!is_string($value) && !is_numeric($value)) {
472
+        if (!is_string($value) && !is_numeric($value)) {
473 473
             $value = null;
474 474
         }
475 475
 
476 476
         $key = (string)$value;
477 477
         
478
-        if(array_key_exists($key, $cache)) {
478
+        if (array_key_exists($key, $cache)) {
479 479
             return $cache[$key];
480 480
         }
481 481
         
@@ -485,31 +485,31 @@  discard block
 block discarded – undo
485 485
             'number' => null
486 486
         );
487 487
         
488
-        if($value === null) {
488
+        if ($value === null) {
489 489
             $cache[$key]['empty'] = true;
490 490
             return $cache[$key];
491 491
         }
492 492
         
493
-        if($value === 0 || $value === '0') {
493
+        if ($value === 0 || $value === '0') {
494 494
             $cache[$key]['number'] = 0;
495 495
             $cache[$key] = $this->filterInfo($cache[$key]);
496 496
             return $cache[$key];
497 497
         }
498 498
         
499 499
         $test = trim($value);
500
-        if($test === '') {
500
+        if ($test === '') {
501 501
             $cache[$key]['empty'] = true;
502 502
             return $cache[$key];
503 503
         }
504 504
         
505 505
         // replace comma notation (which is only possible if it's a string)
506
-        if(is_string($test))
506
+        if (is_string($test))
507 507
         {
508 508
             $test = $this->preProcess($test, $cache, $value);
509 509
         }
510 510
         
511 511
         // convert to a number if it's numeric
512
-        if(is_numeric($test)) {
512
+        if (is_numeric($test)) {
513 513
             $cache[$key]['number'] = $test * 1;
514 514
             $cache[$key] = $this->filterInfo($cache[$key]);
515 515
             return $cache[$key];
@@ -522,16 +522,16 @@  discard block
 block discarded – undo
522 522
         
523 523
         $vlength = strlen($test);
524 524
         $names = array_keys($this->knownUnits);
525
-        foreach($names as $unit)
525
+        foreach ($names as $unit)
526 526
         {
527 527
             $ulength = strlen($unit);
528
-            $start = $vlength-$ulength;
529
-            if($start < 0) {
528
+            $start = $vlength - $ulength;
529
+            if ($start < 0) {
530 530
                 continue;
531 531
             }
532 532
             
533 533
             $search = substr($test, $start, $ulength);
534
-            if($search==$unit) {
534
+            if ($search == $unit) {
535 535
                 $units = $unit;
536 536
                 $number = substr($test, 0, $start);
537 537
                 break;
@@ -539,12 +539,12 @@  discard block
 block discarded – undo
539 539
         }
540 540
         
541 541
         // the filters have to restore the value
542
-        if($this->postProcess)
542
+        if ($this->postProcess)
543 543
         {
544 544
             $number = $this->postProcess($number, $test);
545 545
         }
546 546
         // empty number
547
-        else if($number === '' || $number === null || is_bool($number))
547
+        else if ($number === '' || $number === null || is_bool($number))
548 548
         {
549 549
             $number = null;
550 550
             $cache[$key]['empty'] = true;
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
             $number = trim($number);
556 556
             
557 557
             // may be an arbitrary string in some cases
558
-            if(!is_numeric($number))
558
+            if (!is_numeric($number))
559 559
             {
560 560
                 $number = null;
561 561
                 $cache[$key]['empty'] = true;
@@ -618,12 +618,12 @@  discard block
 block discarded – undo
618 618
     protected function filterInfo($info)
619 619
     {
620 620
         $useUnits = 'px';
621
-        if($info['units'] !== null) {
621
+        if ($info['units'] !== null) {
622 622
             $useUnits = $info['units'];
623 623
         }
624 624
         
625 625
         // the units are non-decimal: convert decimal values
626
-        if($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
626
+        if ($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
627 627
         {
628 628
             $info['number'] = intval($info['number']);
629 629
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -559,8 +559,7 @@
 block discarded – undo
559 559
             {
560 560
                 $number = null;
561 561
                 $cache[$key]['empty'] = true;
562
-            }
563
-            else
562
+            } else
564 563
             {
565 564
                 $number = $number * 1;
566 565
             }
Please login to merge, or discard this patch.
src/SVNHelper/Exception.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     
18 18
     protected $logging = true;
19 19
     
20
-    public function __construct($message, $details=null, $code=null, $previous=null)
20
+    public function __construct($message, $details = null, $code = null, $previous = null)
21 21
     {
22 22
         parent::__construct($message, $details, $code, $previous);
23 23
         
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
     
32 32
     public function __destruct()
33 33
     {
34
-        if(!$this->logging) {
34
+        if (!$this->logging) {
35 35
             return;
36 36
         }
37 37
         
38 38
         $loggers = SVNHelper::getExceptionLoggers();
39 39
         
40
-        if(empty($loggers)) {
40
+        if (empty($loggers)) {
41 41
             return;
42 42
         }
43 43
         
44
-        foreach($loggers as $callback) {
44
+        foreach ($loggers as $callback) {
45 45
             call_user_func($callback, $this);
46 46
         }
47 47
     }
Please login to merge, or discard this patch.
src/SVNHelper/CommandError.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
     public function hasAnyErrorCode($codes)
102 102
     {
103 103
         $items = array();
104
-        foreach($codes as $code) {
104
+        foreach ($codes as $code) {
105 105
             $items[] = ltrim($code, 'e');
106 106
         }
107 107
         
Please login to merge, or discard this patch.
src/SVNHelper/Target.php 3 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
         return $this instanceof SVNHelper_Target_Folder;
77 77
     }
78 78
     
79
-   /**
80
-    * Runs an update of the file or folder.
81
-    * @return SVNHelper_Command_Update
82
-    */
79
+    /**
80
+     * Runs an update of the file or folder.
81
+     * @return SVNHelper_Command_Update
82
+     */
83 83
     public function runUpdate()
84 84
     {
85 85
         $cmd = $this->createUpdate();
@@ -88,55 +88,55 @@  discard block
 block discarded – undo
88 88
         return $cmd;
89 89
     }
90 90
     
91
-   /**
92
-    * Creates an update command instance for the target file or folder.
93
-    * @return SVNHelper_Command_Update
94
-    */
91
+    /**
92
+     * Creates an update command instance for the target file or folder.
93
+     * @return SVNHelper_Command_Update
94
+     */
95 95
     public function createUpdate()
96 96
     {
97 97
         return $this->helper->createUpdate($this);
98 98
     }
99 99
     
100
-   /**
101
-    * Creates a status command instance for the target file or folder.
102
-    * @return SVNHelper_Command_Status
103
-    */
100
+    /**
101
+     * Creates a status command instance for the target file or folder.
102
+     * @return SVNHelper_Command_Status
103
+     */
104 104
     public function createStatus()
105 105
     {
106 106
         return $this->helper->createStatus($this);
107 107
     }
108 108
     
109
-   /**
110
-    * Creates an info command instance for the target file or folder.
111
-    * @return SVNHelper_Command_Info
112
-    */
109
+    /**
110
+     * Creates an info command instance for the target file or folder.
111
+     * @return SVNHelper_Command_Info
112
+     */
113 113
     public function createInfo()
114 114
     {
115 115
         return $this->helper->createInfo($this);
116 116
     }
117 117
     
118
-   /**
119
-    * Creates a commit command instance for the target file or folder.
120
-    * @param string $message
121
-    * @return SVNHelper_Command_Commit
122
-    */
118
+    /**
119
+     * Creates a commit command instance for the target file or folder.
120
+     * @param string $message
121
+     * @return SVNHelper_Command_Commit
122
+     */
123 123
     public function createCommit($message)
124 124
     {
125 125
         return $this->helper->createCommit($this, $message);
126 126
     }
127 127
 
128
-   /**
129
-    * Creates an add command instance for the target file or folder.
130
-    * @return SVNHelper_Command_Add
131
-    */
128
+    /**
129
+     * Creates an add command instance for the target file or folder.
130
+     * @return SVNHelper_Command_Add
131
+     */
132 132
     public function createAdd()
133 133
     {
134 134
         return $this->helper->createAdd($this);
135 135
     }
136 136
     
137
-   /**
138
-    * @return SVNHelper_Command_Status
139
-    */
137
+    /**
138
+     * @return SVNHelper_Command_Status
139
+     */
140 140
     public function getStatus()
141 141
     {
142 142
         $cmd = $this->createStatus();
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
         return $this;
155 155
     }
156 156
     
157
-   /**
158
-    * Whether the target is versioned or needs to be added.
159
-    * @return boolean
160
-    */
157
+    /**
158
+     * Whether the target is versioned or needs to be added.
159
+     * @return boolean
160
+     */
161 161
     public function isVersioned()
162 162
     {
163 163
         return $this->getInfo()->isVersioned();
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
         $this->cache = array();
171 171
     }
172 172
     
173
-   /**
174
-    * Retrieves information on the target.
175
-    * @return SVNHelper_Command_Info
176
-    */
173
+    /**
174
+     * Retrieves information on the target.
175
+     * @return SVNHelper_Command_Info
176
+     */
177 177
     public function getInfo()
178 178
     {
179 179
         if(!isset($this->cache['info'])) {
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
         return $this->cache['info'];
184 184
     }
185 185
     
186
-   /**
187
-    * Commits the target file or folder. If it has
188
-    * not been added to the repository yet, it is 
189
-    * added automatically beforehand. If it does
190
-    * not need to be committed, no changes are made.
191
-    * 
192
-    * @param string $message
193
-    * @return SVNHelper_Target
194
-    */
186
+    /**
187
+     * Commits the target file or folder. If it has
188
+     * not been added to the repository yet, it is 
189
+     * added automatically beforehand. If it does
190
+     * not need to be committed, no changes are made.
191
+     * 
192
+     * @param string $message
193
+     * @return SVNHelper_Target
194
+     */
195 195
     public function runCommit($message)
196 196
     {
197 197
         if(!$this->isVersioned()) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $this->url = $this->helper->getURL().'/'.$this->relativePath;
29 29
         
30 30
         $path = $this->helper->getPath();
31
-        if(!empty($relativePath)) {
31
+        if (!empty($relativePath)) {
32 32
             $path .= $this->helper->getSlash().$this->relativePath;
33 33
         }
34 34
         
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         // this is relevant).
39 39
         $this->path = realpath($path);
40 40
         
41
-        if(!$this->path || !file_exists($this->path)) {
41
+        if (!$this->path || !file_exists($this->path)) {
42 42
             throw new SVNHelper_Exception(
43 43
                 'File not found',
44 44
                 sprintf(
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     
147 147
     public function runAdd()
148 148
     {
149
-        if(!$this->isVersioned()) {
149
+        if (!$this->isVersioned()) {
150 150
             $this->createAdd()->execute();
151 151
             $this->clearCache();
152 152
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     */
177 177
     public function getInfo()
178 178
     {
179
-        if(!isset($this->cache['info'])) {
179
+        if (!isset($this->cache['info'])) {
180 180
             $this->cache['info'] = $this->helper->createInfo($this);
181 181
         }
182 182
         
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
     */
195 195
     public function runCommit($message)
196 196
     {
197
-        if(!$this->isVersioned()) {
197
+        if (!$this->isVersioned()) {
198 198
             $this->log('Adding the unversioned file.');
199 199
             $this->runAdd();
200 200
         }
201 201
         
202
-        if(!$this->isCommitted()) {
202
+        if (!$this->isCommitted()) {
203 203
             $this->createCommit($message)->execute();
204 204
             $this->clearCache();
205 205
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -202,8 +202,7 @@
 block discarded – undo
202 202
         if(!$this->isCommitted()) {
203 203
             $this->createCommit($message)->execute();
204 204
             $this->clearCache();
205
-        }
206
-        else 
205
+        } else 
207 206
         {
208 207
             $this->log('Already committed, nothing to do.');
209 208
         }
Please login to merge, or discard this patch.
src/SVNHelper/CommandException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     protected $result;
20 20
     
21
-    public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous=null)
21
+    public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous = null)
22 22
     {
23 23
         parent::__construct($message, $details, $code, $previous);
24 24
         $this->result = $result;
Please login to merge, or discard this patch.
src/SVNHelper/Command.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
     const SVN_ERROR_TYPE_WARNING = 'warning';
22 22
     
23 23
     /**
24
-    * @var SVNHelper
25
-    */
24
+     * @var SVNHelper
25
+     */
26 26
     protected $helper;
27 27
     
28
-   /**
29
-    * @var SVNHelper_Target
30
-    */
28
+    /**
29
+     * @var SVNHelper_Target
30
+     */
31 31
     protected $target;
32 32
     
33
-   /**
34
-    * @var SVNHelper_CommandResult
35
-    */
33
+    /**
34
+     * @var SVNHelper_CommandResult
35
+     */
36 36
     protected $result;
37 37
     
38 38
     public function __construct(SVNHelper $helper, SVNHelper_Target $target)
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
         $this->target = $target;
42 42
     }
43 43
     
44
-   /**
45
-    * @return SVNHelper
46
-    */
44
+    /**
45
+     * @return SVNHelper
46
+     */
47 47
     public function getSVN()
48 48
     {
49 49
         return $this->helper;
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         return $cmd;
100 100
     }
101 101
 
102
-   /**
103
-    * Executes the specified command, and returns a result
104
-    * instance to read the results.
105
-    * 
106
-    * @param string $mode The command mode, e.g. commit / update...
107
-    * @param string $path The path to apply the command to
108
-    * @param array $params
109
-    * @return SVNHelper_CommandResult
110
-    */
102
+    /**
103
+     * Executes the specified command, and returns a result
104
+     * instance to read the results.
105
+     * 
106
+     * @param string $mode The command mode, e.g. commit / update...
107
+     * @param string $path The path to apply the command to
108
+     * @param array $params
109
+     * @return SVNHelper_CommandResult
110
+     */
111 111
     protected function execCommand($mode, $path=null, $params=array())
112 112
     {
113 113
         $relative = $this->helper->relativizePath($path);
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
         return $this->result;
195 195
     }
196 196
     
197
-   /**
198
-    * Retrieves the type of command, e.g. "Commit"
199
-    * @return string
200
-    */
197
+    /**
198
+     * Retrieves the type of command, e.g. "Commit"
199
+     * @return string
200
+     */
201 201
     public function getType()
202 202
     {
203 203
         return str_replace('SVNHelper_Command_', '', get_class($this));   
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     
57 57
     public function execute()
58 58
     {
59
-        if(isset($this->result)) {
59
+        if (isset($this->result)) {
60 60
             return $this->result;
61 61
         }
62 62
         
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         putenv('LC_ALL='.$locale);
67 67
         
68 68
         $this->result = $this->_execute();
69
-        if(!$this->result instanceof SVNHelper_CommandResult) {
69
+        if (!$this->result instanceof SVNHelper_CommandResult) {
70 70
             throw new SVNHelper_Exception(
71 71
                 'Not a valid SVN command result',
72 72
                 sprintf(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     
83 83
     abstract protected function _execute();
84 84
 
85
-    protected function buildCommand($mode, $path=null, $params=array())
85
+    protected function buildCommand($mode, $path = null, $params = array())
86 86
     {
87 87
         $params[] = 'non-interactive';
88 88
         $params[] = 'username '.$this->helper->getAuthUser();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         
91 91
         $cmd = 'svn '.$mode.' '.$path.' ';
92 92
         
93
-        foreach($params as $param) {
93
+        foreach ($params as $param) {
94 94
             $cmd .= '--'.$param.' ';
95 95
         }
96 96
         
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     * @param array $params
109 109
     * @return SVNHelper_CommandResult
110 110
     */
111
-    protected function execCommand($mode, $path=null, $params=array())
111
+    protected function execCommand($mode, $path = null, $params = array())
112 112
     {
113 113
         $relative = $this->helper->relativizePath($path);
114 114
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         exec($cmd, $output);
124 124
         
125 125
         $lines = array();
126
-        foreach($output as $line) {
126
+        foreach ($output as $line) {
127 127
             $lines[] = mb_strtolower(trim(utf8_encode($line)));
128 128
         }
129 129
         
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         //
136 136
         // Can happen for example when the path is not under version
137 137
         // control.
138
-        if(isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped')
138
+        if (isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped')
139 139
         {
140 140
             $tokens = explode('--', $lines[0]);
141 141
             $message = trim(array_pop($tokens));
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
         // svn: w123456: warning message
157 157
         else
158 158
         {
159
-            foreach($lines as $line) 
159
+            foreach ($lines as $line) 
160 160
             {
161
-                if(strstr($line, 'svn:')) 
161
+                if (strstr($line, 'svn:')) 
162 162
                 {
163 163
                     $result = array();
164 164
                     preg_match_all('/svn:[ ]*(e|warning:[ ]*w)([0-9]+):(.*)/', $line, $result, PREG_PATTERN_ORDER);
165 165
                     
166
-                    if(isset($result[1]) && isset($result[1][0])) 
166
+                    if (isset($result[1]) && isset($result[1][0])) 
167 167
                     {
168 168
                         $message = trim($result[3][0]);
169 169
                         $code = trim($result[2][0]);
170 170
                         $type = self::SVN_ERROR_TYPE_ERROR;
171 171
                         
172
-                        if($result[1][0] != 'e') {
172
+                        if ($result[1][0] != 'e') {
173 173
                             $type = self::SVN_ERROR_TYPE_WARNING;
174 174
                         }
175 175
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         
183 183
         $result = new SVNHelper_CommandResult($this, $cmd, $lines, $errorMessages);
184 184
         
185
-        if($result->isError()) {
185
+        if ($result->isError()) {
186 186
             $this->log(sprintf('[%s] | Command returned errors.', $relative));
187 187
         } 
188 188
         
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     
206 206
     protected function throwExceptionUnexpected(SVNHelper_CommandResult $result)
207 207
     {
208
-        if($result->isConnectionFailed()) {
208
+        if ($result->isConnectionFailed()) {
209 209
             $this->throwException(
210 210
                 t('Could not connect to the remote SVN repository'), 
211 211
                 '', 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             );
215 215
         }
216 216
         
217
-        if($result->hasConflicts()) {
217
+        if ($result->hasConflicts()) {
218 218
             $this->throwException(
219 219
                 t('SVN command reported conflicts'), 
220 220
                 '', 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             );
224 224
         }
225 225
         
226
-        if($result->hasLocks()) {
226
+        if ($result->hasLocks()) {
227 227
             $this->throwException(
228 228
                 t('The target SVN folder or file is locked.'), 
229 229
                 '', 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         );
241 241
     }
242 242
     
243
-    protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous=null)
243
+    protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous = null)
244 244
     {
245 245
         $body = 
246 246
         '<p>'.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         '</p>'.
256 256
         '<ul>';
257 257
             $errors = $result->getErrorMessages();
258
-            foreach($errors as $error) {
258
+            foreach ($errors as $error) {
259 259
                 $body .= 
260 260
                 '<li>'.
261 261
                     $error.
Please login to merge, or discard this patch.
src/SVNHelper/CommandResult.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@  discard block
 block discarded – undo
4 4
 
5 5
 class SVNHelper_CommandResult
6 6
 {
7
-   /**
8
-    * @var SVNHelper_Command
9
-    */
7
+    /**
8
+     * @var SVNHelper_Command
9
+     */
10 10
     protected $command;
11 11
     
12
-   /**
13
-    * @var string[]
14
-    */
12
+    /**
13
+     * @var string[]
14
+     */
15 15
     protected $output;
16 16
     
17
-   /**
18
-    * @var SVNHelper_CommandError[]
19
-    */
17
+    /**
18
+     * @var SVNHelper_CommandError[]
19
+     */
20 20
     protected $errors = array();
21 21
     
22
-   /**
23
-    * @var SVNHelper_CommandError[]
24
-    */
22
+    /**
23
+     * @var SVNHelper_CommandError[]
24
+     */
25 25
     protected $warnings = array();
26 26
     
27
-   /**
28
-    * The actual command that has been executed
29
-    * @var string
30
-    */
27
+    /**
28
+     * The actual command that has been executed
29
+     * @var string
30
+     */
31 31
     protected $commandLine;
32 32
     
33
-   /**
34
-    * @param SVNHelper_Command $command
35
-    * @param string[] $output
36
-    * @param SVNHelper_CommandError[] $errors
37
-    */
33
+    /**
34
+     * @param SVNHelper_Command $command
35
+     * @param string[] $output
36
+     * @param SVNHelper_CommandError[] $errors
37
+     */
38 38
     public function __construct(SVNHelper_Command $command, $commandLine, $output, $errors)
39 39
     {
40 40
         $this->command = $command;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         return $this->command;
87 87
     }
88 88
     
89
-   /**
90
-    * Retrieves all error messages.
91
-    * 
92
-    * @param string $asString
93
-    * @return string|string[]
94
-    */
89
+    /**
90
+     * Retrieves all error messages.
91
+     * 
92
+     * @param string $asString
93
+     * @return string|string[]
94
+     */
95 95
     public function getErrorMessages($asString=false)
96 96
     {
97 97
         if($asString) {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
         $this->commandLine = $commandLine;
42 42
         $this->output = $output;
43 43
         
44
-        foreach($errors as $error) {
45
-            if($error->isError()) {
44
+        foreach ($errors as $error) {
45
+            if ($error->isError()) {
46 46
                 $this->errors[] = $error;
47 47
             } else {
48 48
                 $this->warnings[] = $error;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     
63 63
     public function hasErrorCode($code)
64 64
     {
65
-        foreach($this->errors as $error) {
66
-            if($error->getCode() == $code) {
65
+        foreach ($this->errors as $error) {
66
+            if ($error->getCode() == $code) {
67 67
                 return true;
68 68
             }
69 69
         }
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
     * @param string $asString
93 93
     * @return string|string[]
94 94
     */
95
-    public function getErrorMessages($asString=false)
95
+    public function getErrorMessages($asString = false)
96 96
     {
97
-        if($asString) {
97
+        if ($asString) {
98 98
             $lines = array();
99
-            foreach($this->errors as $error) {
99
+            foreach ($this->errors as $error) {
100 100
                 $lines[] = (string)$error;
101 101
             }
102 102
             
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
         
106 106
         $messages = array();
107
-        foreach($this->errors as $error) {
107
+        foreach ($this->errors as $error) {
108 108
             $messages[] = (string)$error;
109 109
         }
110 110
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     
124 124
     public function getLastLine()
125 125
     {
126
-        return $this->output[count($this->output)-1];
126
+        return $this->output[count($this->output) - 1];
127 127
     }
128 128
     
129 129
     public function getFirstLine()
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
     
139 139
     public function isConnectionFailed()
140 140
     {
141
-        foreach($this->errors as $error) {
142
-            if($error->isConnectionFailed()) {
141
+        foreach ($this->errors as $error) {
142
+            if ($error->isConnectionFailed()) {
143 143
                 return true;
144 144
             }
145 145
         }
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
     
150 150
     public function hasConflicts()
151 151
     {
152
-        foreach($this->errors as $error) {
153
-            if($error->isConflict()) {
152
+        foreach ($this->errors as $error) {
153
+            if ($error->isConflict()) {
154 154
                 return true;
155 155
             }
156 156
         }
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
     
161 161
     public function hasLocks()
162 162
     {
163
-        foreach($this->errors as $error) {
164
-            if($error->isLock()) {
163
+        foreach ($this->errors as $error) {
164
+            if ($error->isLock()) {
165 165
                 return true;
166 166
             }
167 167
         }
Please login to merge, or discard this patch.
src/SVNHelper/Command/Add.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     {
15 15
         $result = $this->execCommand('add', $this->target->getPath());
16 16
 
17
-        if($result->isError()) {
17
+        if ($result->isError()) {
18 18
             throw new SVNHelper_Exception(
19 19
                 'Could not add target path',
20 20
                 sprintf(
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         }
28 28
         
29 29
         $line = $result->getFirstLine();
30
-        if(substr($line, 0, 1) != 'a') {
30
+        if (substr($line, 0, 1) != 'a') {
31 31
             throw new SVNHelper_Exception(
32 32
                 'Unexpected result for adding a path',
33 33
                 sprintf(
Please login to merge, or discard this patch.
src/SVNHelper/Command/Commit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
             )
17 17
         );
18 18
         
19
-        if($result->isError()) {
19
+        if ($result->isError()) {
20 20
             $this->throwExceptionUnexpected($result);
21 21
         }
22 22
         
Please login to merge, or discard this patch.