Passed
Push — master ( 6080f3...d98100 )
by Sebastian
03:12
created
src/NumberInfo.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     protected function _setValue($value)
132 132
     {
133
-        if($value instanceof NumberInfo) {
133
+        if ($value instanceof NumberInfo) {
134 134
             $value = $value->getValue();
135 135
         }
136 136
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function isPositive() : bool
172 172
     {
173
-        if($this->isEmpty())
173
+        if ($this->isEmpty())
174 174
         {
175 175
             return false;
176 176
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function isZero() : bool
187 187
     {
188
-        if($this->isEmpty())
188
+        if ($this->isEmpty())
189 189
         {
190 190
             return false;
191 191
         }
@@ -231,23 +231,23 @@  discard block
 block discarded – undo
231 231
     {
232 232
         // Append the units if the value is a number,
233 233
         // so they can be inherited.
234
-        if($this->hasUnits() && is_numeric($number))
234
+        if ($this->hasUnits() && is_numeric($number))
235 235
         {
236 236
             $number .= $this->getUnits();
237 237
         }
238 238
 
239 239
         $new = parseNumber($number);
240 240
 
241
-        if($new->isEmpty())
241
+        if ($new->isEmpty())
242 242
         {
243 243
             return $this;
244 244
         }
245 245
 
246
-        if($new->getUnits() === $this->getUnits())
246
+        if ($new->getUnits() === $this->getUnits())
247 247
         {
248 248
             $value = $new->getNumber();
249 249
 
250
-            if($this->hasUnits()) {
250
+            if ($this->hasUnits()) {
251 251
                 $value .= $this->getUnits();
252 252
             }
253 253
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $number = (float)$this->info['number'];
291 291
 
292
-        if($this->hasDecimals())
292
+        if ($this->hasDecimals())
293 293
         {
294 294
             return $number;
295 295
         }
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public function getUnits() : string
327 327
     {
328
-        if($this->isEmpty()) {
328
+        if ($this->isEmpty()) {
329 329
             return '';
330 330
         }
331 331
 
332
-        if(!$this->hasUnits()) {
332
+        if (!$this->hasUnits()) {
333 333
             return 'px';
334 334
         }
335 335
         
@@ -363,15 +363,15 @@  discard block
 block discarded – undo
363 363
      */
364 364
     public function toAttribute() : string
365 365
     {
366
-        if($this->isEmpty()) {
366
+        if ($this->isEmpty()) {
367 367
             return '';
368 368
         }
369 369
         
370
-        if($this->isZero()) {
370
+        if ($this->isZero()) {
371 371
             return '0';
372 372
         }
373 373
         
374
-        if($this->isPercent()) {
374
+        if ($this->isPercent()) {
375 375
             return $this->getNumber().$this->getUnits();
376 376
         }
377 377
         
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function toCSS() : string
386 386
     {
387
-        if($this->isEmpty()) {
387
+        if ($this->isEmpty()) {
388 388
             return '';
389 389
         }
390 390
         
391
-        if($this->isZero()) {
391
+        if ($this->isZero()) {
392 392
             return '0';
393 393
         }
394 394
         
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     
398 398
     public function __toString()
399 399
     {
400
-        if($this->isEmpty()) {
400
+        if ($this->isEmpty()) {
401 401
             return '';
402 402
         }
403 403
         
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
      */
504 504
     public function add($value)
505 505
     {
506
-        if($this->isEmpty())
506
+        if ($this->isEmpty())
507 507
         {
508 508
             $this->setValue($value);
509 509
             return $this;
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
         
512 512
         $number = parseNumber($value);
513 513
         
514
-        if($number->getUnits() === $this->getUnits() || !$number->hasUnits())
514
+        if ($number->getUnits() === $this->getUnits() || !$number->hasUnits())
515 515
         {
516 516
             $new = $this->getNumber() + $number->getNumber();
517 517
 
518
-            if($this->hasUnits())
518
+            if ($this->hasUnits())
519 519
             {
520 520
                 $new .= $this->getUnits();
521 521
             }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      */
537 537
     public function subtract($value)
538 538
     {
539
-        if($this->isEmpty())
539
+        if ($this->isEmpty())
540 540
         {
541 541
             $this->setValue($value);
542 542
             return $this;
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
         
545 545
         $number = parseNumber($value);
546 546
         
547
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
547
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
548 548
         {
549 549
             $new = $this->getNumber() - $number->getNumber();
550 550
 
551
-            if($this->hasUnits())
551
+            if ($this->hasUnits())
552 552
             {
553 553
                 $new .= $this->getUnits();
554 554
             }
@@ -588,13 +588,13 @@  discard block
 block discarded – undo
588 588
      */
589 589
     protected function percentOperation(string $operation, $percent)
590 590
     {
591
-        if($this->isZeroOrEmpty()) {
591
+        if ($this->isZeroOrEmpty()) {
592 592
             return $this;
593 593
         }
594 594
         
595 595
         $percent = parseNumber($percent);
596 596
 
597
-        if($percent->hasUnits() && !$percent->isPercent())
597
+        if ($percent->hasUnits() && !$percent->isPercent())
598 598
         {
599 599
             return $this;
600 600
         }
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
         $number = $this->getNumber();
603 603
         $value = $number * $percent->getNumber() / 100;
604 604
         
605
-        if($operation == '-') {
605
+        if ($operation == '-') {
606 606
             $number = $number - $value;
607 607
         } else {
608 608
             $number = $number + $value;
609 609
         }
610 610
         
611
-        if($this->isUnitInteger())
611
+        if ($this->isUnitInteger())
612 612
         {
613 613
             $number = intval($number);
614 614
         }
615 615
 
616
-        if($this->hasUnits())
616
+        if ($this->hasUnits())
617 617
         {
618 618
             $number .= $this->getUnits();
619 619
         }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     {
628 628
         $units = $this->getUnits();
629 629
 
630
-        if(isset($this->knownUnits[$units]))
630
+        if (isset($this->knownUnits[$units]))
631 631
         {
632 632
             return !$this->knownUnits[$units];
633 633
         }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     {
640 640
         $units = $this->getUnits();
641 641
 
642
-        if(isset($this->knownUnits[$units]))
642
+        if (isset($this->knownUnits[$units]))
643 643
         {
644 644
             return $this->knownUnits[$units];
645 645
         }
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         
679 679
         $key = $this->createValueKey($value);
680 680
 
681
-        if(array_key_exists($key, $cache)) {
681
+        if (array_key_exists($key, $cache)) {
682 682
             return $cache[$key];
683 683
         }
684 684
         
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
             'number' => null
689 689
         );
690 690
         
691
-        if($key === '_EMPTY_') 
691
+        if ($key === '_EMPTY_') 
692 692
         {
693 693
             $cache[$key]['empty'] = true;
694 694
             return $cache[$key];
695 695
         }
696 696
         
697
-        if($value === 0 || $value === '0') 
697
+        if ($value === 0 || $value === '0') 
698 698
         {
699 699
             $cache[$key]['number'] = 0;
700 700
             $cache[$key] = $this->filterInfo($cache[$key]);
@@ -703,20 +703,20 @@  discard block
 block discarded – undo
703 703
         
704 704
         $test = trim((string)$value);
705 705
         
706
-        if($test === '') 
706
+        if ($test === '') 
707 707
         {
708 708
             $cache[$key]['empty'] = true;
709 709
             return $cache[$key];
710 710
         }
711 711
         
712 712
         // replace comma notation (which is only possible if it's a string)
713
-        if(is_string($value))
713
+        if (is_string($value))
714 714
         {
715 715
             $test = $this->preProcess($test, $cache, $value);
716 716
         }
717 717
         
718 718
         // convert to a number if it's numeric
719
-        if(is_numeric($test)) 
719
+        if (is_numeric($test)) 
720 720
         {
721 721
             $cache[$key]['number'] = (float)$test * 1;
722 722
             $cache[$key] = $this->filterInfo($cache[$key]);
@@ -742,19 +742,19 @@  discard block
 block discarded – undo
742 742
         $empty = false;
743 743
         
744 744
         $found = $this->findUnits($test);
745
-        if($found !== null) 
745
+        if ($found !== null) 
746 746
         {
747 747
             $number = $found['number'];
748 748
             $units = $found['units'];
749 749
         }
750 750
         
751 751
         // the filters have to restore the value
752
-        if($this->postProcess)
752
+        if ($this->postProcess)
753 753
         {
754 754
             $number = $this->postProcess($number, $test);
755 755
         }
756 756
         // empty number
757
-        else if($number === '' || $number === null || is_bool($number))
757
+        else if ($number === '' || $number === null || is_bool($number))
758 758
         {
759 759
             $number = null;
760 760
             $empty = true;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $number = trim($number);
766 766
             
767 767
             // may be an arbitrary string in some cases
768
-            if(!is_numeric($number))
768
+            if (!is_numeric($number))
769 769
             {
770 770
                 $number = null;
771 771
                 $empty = true;
@@ -797,17 +797,17 @@  discard block
 block discarded – undo
797 797
         $vlength = strlen($value);
798 798
         $names = array_keys($this->knownUnits);
799 799
         
800
-        foreach($names as $unit)
800
+        foreach ($names as $unit)
801 801
         {
802 802
             $ulength = strlen($unit);
803
-            $start = $vlength-$ulength;
804
-            if($start < 0) {
803
+            $start = $vlength - $ulength;
804
+            if ($start < 0) {
805 805
                 continue;
806 806
             }
807 807
             
808 808
             $search = substr($value, $start, $ulength);
809 809
             
810
-            if($search==$unit) 
810
+            if ($search == $unit) 
811 811
             {
812 812
                 return array(
813 813
                     'units' => $unit,
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     */
828 828
     private function createValueKey($value) : string
829 829
     {
830
-        if(!is_string($value) && !is_numeric($value))
830
+        if (!is_string($value) && !is_numeric($value))
831 831
         {
832 832
             return '_EMPTY_';
833 833
         }
@@ -891,12 +891,12 @@  discard block
 block discarded – undo
891 891
     protected function filterInfo(array $info) : array
892 892
     {
893 893
         $useUnits = 'px';
894
-        if($info['units'] !== null) {
894
+        if ($info['units'] !== null) {
895 895
             $useUnits = $info['units'];
896 896
         }
897 897
         
898 898
         // the units are non-decimal: convert decimal values
899
-        if($this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
899
+        if ($this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
900 900
         {
901 901
             $info['number'] = intval($info['number']);
902 902
         }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
     {
923 923
         $number = floor($this->getNumber());
924 924
 
925
-        if($number % 2 == 1) $number--;
925
+        if ($number % 2 == 1) $number--;
926 926
 
927 927
         return $this->setNumber($number);
928 928
     }
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
     {
939 939
         $number = ceil($this->getNumber());
940 940
 
941
-        if($number % 2 == 1) $number++;
941
+        if ($number % 2 == 1) $number++;
942 942
 
943 943
         return $this->setNumber($number);
944 944
     }
Please login to merge, or discard this patch.
src/NamedClosure.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public static function fromClosure(Closure $closure, $origin) : NamedClosure
106 106
     {
107
-        if(is_object($origin))
107
+        if (is_object($origin))
108 108
         {
109 109
             $description = get_class($origin);
110 110
         }
111
-        else if(is_array($origin))
111
+        else if (is_array($origin))
112 112
         {
113 113
             $description = ConvertHelper::callback2string($origin);
114 114
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string|object $origin Optional origin. If not specified, the object and method name are used instead.
127 127
      * @return NamedClosure
128 128
      */
129
-    public static function fromObject(object $object, string $method, $origin='') : NamedClosure
129
+    public static function fromObject(object $object, string $method, $origin = '') : NamedClosure
130 130
     {
131 131
         return self::fromArray(array($object, $method), $origin);
132 132
     }
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
      * @param string|object $origin
137 137
      * @return NamedClosure
138 138
      */
139
-    public static function fromArray(array $callback, $origin='') : NamedClosure
139
+    public static function fromArray(array $callback, $origin = '') : NamedClosure
140 140
     {
141
-        if(empty($origin)) {
141
+        if (empty($origin)) {
142 142
             $origin = ConvertHelper::callback2string($callback);
143
-        } else if(is_object($origin)) {
143
+        } else if (is_object($origin)) {
144 144
             $origin = get_class($origin);
145 145
         }
146 146
 
Please login to merge, or discard this patch.
src/OperationResult/Collection.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param int $code
37 37
      * @return $this
38 38
      */
39
-    public function makeError(string $message, int $code=0) : OperationResult
39
+    public function makeError(string $message, int $code = 0) : OperationResult
40 40
     {
41 41
         return $this->add('makeError', $message, $code);
42 42
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param int $code
47 47
      * @return $this
48 48
      */
49
-    public function makeSuccess(string $message, int $code=0) : OperationResult
49
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
50 50
     {
51 51
         return $this->add('makeSuccess', $message, $code);
52 52
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param int $code
57 57
      * @return $this
58 58
      */
59
-    public function makeWarning(string $message, int $code=0) : OperationResult
59
+    public function makeWarning(string $message, int $code = 0) : OperationResult
60 60
     {
61 61
         return $this->add('makeWarning', $message, $code);
62 62
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param int $code
67 67
      * @return $this
68 68
      */
69
-    public function makeNotice(string $message, int $code=0) : OperationResult
69
+    public function makeNotice(string $message, int $code = 0) : OperationResult
70 70
     {
71 71
         return $this->add('makeNotice', $message, $code);
72 72
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param int $code
78 78
      * @return $this
79 79
      */
80
-    protected function add(string $method, string $message, int $code=0) : OperationResult
80
+    protected function add(string $method, string $message, int $code = 0) : OperationResult
81 81
     {
82 82
         $result = new OperationResult($this->subject);
83 83
         $result->$method($message, $code);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function addResult(OperationResult $result) : OperationResult_Collection
97 97
     {
98
-        if($result instanceof OperationResult_Collection)
98
+        if ($result instanceof OperationResult_Collection)
99 99
         {
100 100
             return $this->importCollection($result);
101 101
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $results = $collection->getResults();
117 117
         
118
-        foreach($results as $result)
118
+        foreach ($results as $result)
119 119
         {
120 120
             $this->addResult($result);
121 121
         }
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     
134 134
     public function isValid() : bool
135 135
     {
136
-        foreach($this->results as $result)
136
+        foreach ($this->results as $result)
137 137
         {
138
-            if(!$result->isValid())
138
+            if (!$result->isValid())
139 139
             {
140 140
                 return false;
141 141
             }
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
     
147 147
     public function hasCode() : bool
148 148
     {
149
-        foreach($this->results as $result)
149
+        foreach ($this->results as $result)
150 150
         {
151
-            if($result->hasCode())
151
+            if ($result->hasCode())
152 152
             {
153 153
                 return true;
154 154
             }
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
     
160 160
     public function getCode() : int
161 161
     {
162
-        foreach($this->results as $result)
162
+        foreach ($this->results as $result)
163 163
         {
164
-            if($result->hasCode())
164
+            if ($result->hasCode())
165 165
             {
166 166
                 return $result->getCode();
167 167
             }
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
         return 0;
171 171
     }
172 172
     
173
-    public function getMessage(string $type='') : string
173
+    public function getMessage(string $type = '') : string
174 174
     {
175
-        foreach($this->results as $result)
175
+        foreach ($this->results as $result)
176 176
         {
177 177
             $msg = $result->getMessage($type);
178 178
             
179
-            if(!empty($msg))
179
+            if (!empty($msg))
180 180
             {
181 181
                 return $msg;
182 182
             }
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     
188 188
     public function containsCode(int $code) : bool
189 189
     {
190
-        foreach($this->results as $result)
190
+        foreach ($this->results as $result)
191 191
         {
192
-            if($result->getCode() === $code)
192
+            if ($result->getCode() === $code)
193 193
             {
194 194
                 return true;
195 195
             }
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $amount = 0;
224 224
         
225
-        foreach($this->results as $result)
225
+        foreach ($this->results as $result)
226 226
         {
227
-            if($result->isType($type))
227
+            if ($result->isType($type))
228 228
             {
229 229
                 $amount++;
230 230
             }
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $results = array();
264 264
         
265
-        foreach($this->results as $result)
265
+        foreach ($this->results as $result)
266 266
         {
267
-            if($result->isType($type))
267
+            if ($result->isType($type))
268 268
             {
269 269
                 $results[] = $result;
270 270
             }
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
     
276 276
     public function isType(string $type) : bool
277 277
     {
278
-        foreach($this->results as $result)
278
+        foreach ($this->results as $result)
279 279
         {
280
-            if($result->isType($type))
280
+            if ($result->isType($type))
281 281
             {
282 282
                 return true;
283 283
             }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $lines[] = 'Collection #'.$this->getID();
294 294
         $lines[] = 'Subject: '.get_class($this->subject);
295 295
         
296
-        foreach($this->results as $result)
296
+        foreach ($this->results as $result)
297 297
         {
298 298
             $lines[] = ' - '.$result->getType().' #'.$result->getCode().' "'.$result->getMessage($result->getType()).'"';
299 299
         }
Please login to merge, or discard this patch.
src/OperationResult.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     * @param string $message Should not contain a date, just the system specific info.
145 145
     * @return $this
146 146
     */
147
-    public function makeSuccess(string $message, int $code=0) : OperationResult
147
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
148 148
     {
149 149
         return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true);
150 150
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     * @param string $message Should be as detailed as possible.
156 156
     * @return $this
157 157
     */
158
-    public function makeError(string $message, int $code=0) : OperationResult
158
+    public function makeError(string $message, int $code = 0) : OperationResult
159 159
     {
160 160
         return $this->setMessage(self::TYPE_ERROR, $message, $code, false);
161 161
     }
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
         return $this->code;
253 253
     }
254 254
     
255
-    public function getMessage(string $type='') : string
255
+    public function getMessage(string $type = '') : string
256 256
     {
257
-        if(!empty($type))
257
+        if (!empty($type))
258 258
         {
259
-            if($this->type === $type)
259
+            if ($this->type === $type)
260 260
             {
261 261
                 return $this->message;
262 262
             }
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
      *
281 281
      * @throws ConvertHelper_Exception
282 282
      */
283
-    public function makeException(Throwable $e, int $code=0, bool $withDeveloperInfo=false) : OperationResult
283
+    public function makeException(Throwable $e, int $code = 0, bool $withDeveloperInfo = false) : OperationResult
284 284
     {
285 285
         $info = parseThrowable($e);
286 286
 
287
-        if($code === 0)
287
+        if ($code === 0)
288 288
         {
289 289
             $code = $info->getCode();
290 290
         }
Please login to merge, or discard this patch.
src/Microtime.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
      * @see Microtime::createFromString()
115 115
      * @see Microtime::createNow()
116 116
      */
117
-    public function __construct($datetime=self::DATETIME_NOW, ?DateTimeZone $timeZone=null)
117
+    public function __construct($datetime = self::DATETIME_NOW, ?DateTimeZone $timeZone = null)
118 118
     {
119
-        if($datetime instanceof Microtime_ParseResult)
119
+        if ($datetime instanceof Microtime_ParseResult)
120 120
         {
121 121
             $parsed = $datetime;
122 122
         }
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
      * @return Microtime_ParseResult
149 149
      * @throws Microtime_Exception
150 150
      */
151
-    private function parseDate($datetime, ?DateTimeZone $timeZone=null) : Microtime_ParseResult
151
+    private function parseDate($datetime, ?DateTimeZone $timeZone = null) : Microtime_ParseResult
152 152
     {
153
-        if($datetime instanceof Microtime)
153
+        if ($datetime instanceof Microtime)
154 154
         {
155 155
             return new Microtime_ParseResult(
156 156
                 $datetime->getISODate(),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             );
159 159
         }
160 160
 
161
-        if($datetime instanceof DateTime)
161
+        if ($datetime instanceof DateTime)
162 162
         {
163 163
             return new Microtime_ParseResult(
164 164
                 $datetime->format(self::FORMAT_ISO),
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
             );
167 167
         }
168 168
 
169
-        if($timeZone === null)
169
+        if ($timeZone === null)
170 170
         {
171 171
             $timeZone = new DateTimeZone(date_default_timezone_get());
172 172
         }
173 173
 
174
-        if(empty($datetime) || $datetime === self::DATETIME_NOW)
174
+        if (empty($datetime) || $datetime === self::DATETIME_NOW)
175 175
         {
176 176
             return self::parseNow($timeZone);
177 177
         }
178 178
 
179
-        if(is_string($datetime))
179
+        if (is_string($datetime))
180 180
         {
181 181
             return new Microtime_ParseResult(
182 182
                 $datetime,
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     {
204 204
         $dateObj = DateTime::createFromFormat('0.u00 U', microtime(), new DateTimeZone('America/Denver'));
205 205
 
206
-        if($dateObj !== false)
206
+        if ($dateObj !== false)
207 207
         {
208 208
             $dateObj->setTimezone($timeZone);
209 209
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      * @return Microtime
228 228
      * @throws Microtime_Exception
229 229
      */
230
-    public static function createNow(?DateTimeZone $timeZone=null) : Microtime
230
+    public static function createNow(?DateTimeZone $timeZone = null) : Microtime
231 231
     {
232
-        if($timeZone === null)
232
+        if ($timeZone === null)
233 233
         {
234 234
             $timeZone = new DateTimeZone(date_default_timezone_get());
235 235
         }
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
      * @return Microtime
247 247
      * @throws Microtime_Exception
248 248
      */
249
-    public static function createFromString(string $date, ?DateTimeZone $timeZone=null) : Microtime
249
+    public static function createFromString(string $date, ?DateTimeZone $timeZone = null) : Microtime
250 250
     {
251
-        if($timeZone === null)
251
+        if ($timeZone === null)
252 252
         {
253 253
             $timeZone = new DateTimeZone(date_default_timezone_get());
254 254
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function __construct($subject)
82 82
     {
83
-        if(is_array($subject))
83
+        if (is_array($subject))
84 84
         {
85 85
             $this->parseSerialized($subject);
86 86
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     */
140 140
     public function getPrevious() : ConvertHelper_ThrowableInfo
141 141
     {
142
-        if(isset($this->previous)) {
142
+        if (isset($this->previous)) {
143 143
             return $this->previous;
144 144
         }
145 145
         
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     public function getFolderDepth() : int
259 259
     {
260 260
         $depth = $this->getOption('folder-depth');
261
-        if(!empty($depth)) {
261
+        if (!empty($depth)) {
262 262
             return $depth;
263 263
         }
264 264
         
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
         $this->setOptions($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_OPTIONS]);
317 317
         
318
-        foreach($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def)
318
+        foreach ($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def)
319 319
         {
320 320
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def);
321 321
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $this->date = new Microtime();
327 327
         $this->class = get_class($e);
328 328
 
329
-        if($e instanceof BaseException)
329
+        if ($e instanceof BaseException)
330 330
         {
331 331
             $this->details = $e->getDetails();
332 332
         }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      * @return string
360 360
      * @throws ConvertHelper_Exception
361 361
      */
362
-    public function renderErrorMessage(bool $withDeveloperInfo=false) : string
362
+    public function renderErrorMessage(bool $withDeveloperInfo = false) : string
363 363
     {
364 364
         return (new ConvertHelper_ThrowableInfo_MessageRenderer($this, $withDeveloperInfo))
365 365
             ->render();
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         }
436 436
         else
437 437
         {
438
-            $this->message = 'Original error code: [' . $code . ']. ' . $this->message;
438
+            $this->message = 'Original error code: ['.$code.']. '.$this->message;
439 439
         }
440 440
     }
441 441
 
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/MessageRenderer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             ->t('Message:')
39 39
             ->add($this->info->getMessage());
40 40
 
41
-        if($this->developerInfo)
41
+        if ($this->developerInfo)
42 42
         {
43 43
             $message
44 44
                 ->eol()
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 ->add($finalCall->toString());
47 47
         }
48 48
 
49
-        if($this->developerInfo && $this->info->hasDetails())
49
+        if ($this->developerInfo && $this->info->hasDetails())
50 50
         {
51 51
             $message
52 52
                 ->t('Developer details:')
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 ->add($this->info->getDetails());
55 55
         }
56 56
 
57
-        if($this->info->hasPrevious())
57
+        if ($this->info->hasPrevious())
58 58
         {
59 59
             $message
60 60
                 ->eol()
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/StringConverter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
     public function toString() : string
20 20
     {
21 21
         return
22
-            $this->renderMessage() .
23
-            $this->renderCalls() .
22
+            $this->renderMessage().
23
+            $this->renderCalls().
24 24
             $this->renderPrevious();
25 25
     }
26 26
 
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
         if ($this->info->hasCode())
35 35
         {
36
-            $string .= ' #' . $this->info->getCode();
36
+            $string .= ' #'.$this->info->getCode();
37 37
         }
38 38
 
39 39
         $string .=
40
-            ': ' .
41
-            $this->info->getMessage() .
40
+            ': '.
41
+            $this->info->getMessage().
42 42
             PHP_EOL;
43 43
 
44 44
         return $string;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         foreach ($calls as $call)
57 57
         {
58
-            $string .= $call->toString() . PHP_EOL;
58
+            $string .= $call->toString().PHP_EOL;
59 59
         }
60 60
 
61 61
         return $string;
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         }
74 74
 
75 75
         return
76
-            PHP_EOL .
77
-            PHP_EOL .
78
-            'Previous error:' .
79
-            PHP_EOL .
80
-            PHP_EOL .
76
+            PHP_EOL.
77
+            PHP_EOL.
78
+            'Previous error:'.
79
+            PHP_EOL.
80
+            PHP_EOL.
81 81
             $this->info->getPrevious()->toString();
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
src/ZIPHelper.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     
33 33
     public const ERROR_OPENING_ZIP_FILE = 338003;
34 34
     
35
-    public const ERROR_CANNOT_SAVE_FILE_TO_DISK =338004;
35
+    public const ERROR_CANNOT_SAVE_FILE_TO_DISK = 338004;
36 36
     
37 37
     protected $options = array(
38 38
         'WriteThreshold' => 100
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     * 
83 83
     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
84 84
     */
85
-    public function addFile(string $filePath, ?string $zipPath=null) : bool
85
+    public function addFile(string $filePath, ?string $zipPath = null) : bool
86 86
     {
87 87
         $this->open();
88 88
         
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
      */
136 136
     protected function open() : void
137 137
     {
138
-        if($this->open) {
138
+        if ($this->open) {
139 139
             return;
140 140
         }
141 141
         
142
-        if(!isset($this->zip)) {
142
+        if (!isset($this->zip)) {
143 143
             $this->zip = new ZipArchive();
144 144
         }
145 145
         
146 146
         $flag = null;
147
-        if(!file_exists($this->file)) {
147
+        if (!file_exists($this->file)) {
148 148
             $flag = ZipArchive::CREATE;
149 149
         }
150 150
         
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $this->fileTracker++;
189 189
 
190
-        if($this->options['WriteThreshold'] < 1) {
190
+        if ($this->options['WriteThreshold'] < 1) {
191 191
             return;
192 192
         }
193 193
         
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     
201 201
     protected function close() : void
202 202
     {
203
-        if(!$this->open) {
203
+        if (!$this->open) {
204 204
             return;
205 205
         }
206 206
         
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
             throw new ZIPHelper_Exception(
210 210
                 'Could not save ZIP file to disk',
211 211
                 sprintf(
212
-                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, ' .
213
-                    'including adding files that do not exist on disk, trying to create an empty zip, ' .
212
+                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, '.
213
+                    'including adding files that do not exist on disk, trying to create an empty zip, '.
214 214
                     'or trying to save to a directory that does not exist.',
215 215
                     $this->file
216 216
                 ),
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $this->open();
227 227
         
228
-        if($this->countFiles() < 1) 
228
+        if ($this->countFiles() < 1) 
229 229
         {
230 230
             throw new ZIPHelper_Exception(
231 231
                 'No files in the zip file',
@@ -251,18 +251,18 @@  discard block
 block discarded – undo
251 251
      * @throws ZIPHelper_Exception
252 252
      * @return string The file name that was sent (useful in case none was specified).
253 253
      */
254
-    public function download(?string $fileName=null) : string
254
+    public function download(?string $fileName = null) : string
255 255
     {
256 256
         $this->save();
257 257
         
258
-        if(empty($fileName))
258
+        if (empty($fileName))
259 259
         {
260 260
             $fileName = basename($this->file);
261 261
         }
262 262
         
263 263
         header('Content-type: application/zip');
264
-        header('Content-Disposition: attachment; filename=' . $fileName);
265
-        header('Content-length: ' . filesize($this->file));
264
+        header('Content-Disposition: attachment; filename='.$fileName);
265
+        header('Content-length: '.filesize($this->file));
266 266
         header('Pragma: no-cache');
267 267
         header('Expires: 0');
268 268
         readfile($this->file);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * @throws ZIPHelper_Exception
281 281
      * @see ZIPHelper::download()
282 282
      */
283
-    public function downloadAndDelete(?string $fileName=null) : ZIPHelper
283
+    public function downloadAndDelete(?string $fileName = null) : ZIPHelper
284 284
     {
285 285
         $this->download($fileName);
286 286
         
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
     * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder.
298 298
     * @return boolean
299 299
     */
300
-    public function extractAll(?string $outputFolder=null) : bool
300
+    public function extractAll(?string $outputFolder = null) : bool
301 301
     {
302
-        if(empty($outputFolder)) {
302
+        if (empty($outputFolder)) {
303 303
             $outputFolder = dirname($this->file);
304 304
         }
305 305
         
Please login to merge, or discard this patch.