Passed
Push — master ( 4f13bc...123cfe )
by Sebastian
02:27
created
src/PaginationHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     */
114 114
     public function getNextPage() : int
115 115
     {
116
-        if($this->next === 0) {
116
+        if ($this->next === 0) {
117 117
             return $this->last;
118 118
         }
119 119
         
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     */
138 138
     public function getPreviousPage() : int
139 139
     {
140
-        if($this->prev === 0) {
140
+        if ($this->prev === 0) {
141 141
             return 1;
142 142
         }
143 143
         
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         // adjust the adjacent value if it exceeds the
183 183
         // total amount of pages
184 184
         $adjacentTotal = ($adjacent * 2) + 1;
185
-        if($adjacentTotal > $this->last) 
185
+        if ($adjacentTotal > $this->last) 
186 186
         {
187 187
             $adjacent = (int)floor($this->last / 2);
188 188
         }
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
         $back = 0;
196 196
         $fwd = 0;
197 197
         
198
-        if($maxBack >= $adjacent) {
198
+        if ($maxBack >= $adjacent) {
199 199
             $back = $adjacent; 
200 200
         } else {
201 201
             $back = $maxBack;
202 202
         }
203 203
         
204
-        if($maxFwd >= $adjacent)  {
204
+        if ($maxFwd >= $adjacent) {
205 205
             $fwd = $adjacent;
206 206
         } else {
207 207
             $fwd = $maxFwd;
@@ -217,16 +217,16 @@  discard block
 block discarded – undo
217 217
         $fwd += $backDiff;
218 218
         $back += $fwdDiff;
219 219
         
220
-        if($fwd > $maxFwd) { $fwd = $maxFwd; }
221
-        if($back > $maxBack) { $back = $maxBack; }
220
+        if ($fwd > $maxFwd) { $fwd = $maxFwd; }
221
+        if ($back > $maxBack) { $back = $maxBack; }
222 222
         
223 223
         // calculate the first and last page in the list
224 224
         $prev = $this->current - $back;
225 225
         $next = $this->current + $fwd;
226 226
         
227 227
         // failsafe so we stay within the bounds
228
-        if($prev < 1) { $prev = 1; }
229
-        if($next > $this->last) { $next = $this->last; }
228
+        if ($prev < 1) { $prev = 1; }
229
+        if ($next > $this->last) { $next = $this->last; }
230 230
         
231 231
         // create and return the page numbers list
232 232
         $numbers = range($prev, $next);
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
     {
320 320
         $pages = (int)ceil($this->total / $this->perPage);
321 321
         
322
-        if($this->current < 1)
322
+        if ($this->current < 1)
323 323
         {
324 324
             $this->current = 1;
325 325
         }
326
-        else if($this->current > $pages)
326
+        else if ($this->current > $pages)
327 327
         {
328 328
             $this->current = $pages;
329 329
         }
@@ -331,19 +331,19 @@  discard block
 block discarded – undo
331 331
         $this->last = $pages;
332 332
         
333 333
         $nextPage = $this->current + 1;
334
-        if($nextPage <= $pages) {
334
+        if ($nextPage <= $pages) {
335 335
             $this->next = $nextPage;
336 336
         }
337 337
         
338 338
         $prevPage = $this->current - 1;
339
-        if($prevPage > 0) {
339
+        if ($prevPage > 0) {
340 340
             $this->prev = $prevPage;
341 341
         }
342 342
         
343 343
         $this->offsetStart = ($this->current - 1) * $this->perPage;
344 344
         
345 345
         $this->offsetEnd = $this->offsetStart + $this->perPage;
346
-        if($this->offsetEnd > ($this->total - 1)) {
346
+        if ($this->offsetEnd > ($this->total - 1)) {
347 347
             $this->offsetEnd = ($this->total - 1);
348 348
         }
349 349
     }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     
62 62
     protected function __construct($subject)
63 63
     {
64
-        if(is_array($subject))
64
+        if (is_array($subject))
65 65
         {
66 66
             $this->parseSerialized($subject);
67 67
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     */
116 116
     public function getPrevious() : ConvertHelper_ThrowableInfo
117 117
     {
118
-        if(isset($this->previous)) {
118
+        if (isset($this->previous)) {
119 119
             return $this->previous;
120 120
         }
121 121
         
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
         
141 141
         $string = 'Exception';
142 142
         
143
-        if($this->hasCode()) {
143
+        if ($this->hasCode()) {
144 144
             $string .= ' #'.$this->code;
145 145
         }
146 146
         
147 147
         $string .= ': '.$this->getMessage().PHP_EOL;
148 148
         
149
-        foreach($calls as $call) 
149
+        foreach ($calls as $call) 
150 150
         {
151 151
             $string .= $call->toString().PHP_EOL;
152 152
         }
153 153
         
154
-        if($this->hasPrevious())
154
+        if ($this->hasPrevious())
155 155
         {
156 156
             $string .= PHP_EOL.PHP_EOL.
157 157
             'Previous error:'.PHP_EOL.PHP_EOL.
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
             'previous' => null,
243 243
         );
244 244
         
245
-        if($this->hasPrevious()) {
246
-            $result['previous'] =  $this->previous->serialize();
245
+        if ($this->hasPrevious()) {
246
+            $result['previous'] = $this->previous->serialize();
247 247
         }
248 248
         
249
-        foreach($this->calls as $call)
249
+        foreach ($this->calls as $call)
250 250
         {
251 251
             $result['calls'][] = $call->serialize(); 
252 252
         }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     public function getFolderDepth() : int
276 276
     {
277 277
         $depth = $this->getOption('folder-depth');
278
-        if(!empty($depth)) {
278
+        if (!empty($depth)) {
279 279
             return $depth;
280 280
         }
281 281
         
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
         
312 312
         $this->setOptions($serialized['options']);
313 313
         
314
-        if(!empty($serialized['previous']))
314
+        if (!empty($serialized['previous']))
315 315
         {
316 316
             $this->previous = ConvertHelper_ThrowableInfo::fromSerialized($serialized['previous']);
317 317
         }
318 318
         
319
-        foreach($serialized['calls'] as $def)
319
+        foreach ($serialized['calls'] as $def)
320 320
         {
321 321
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def);
322 322
         }
@@ -328,16 +328,16 @@  discard block
 block discarded – undo
328 328
         $this->message = $e->getMessage();
329 329
         $this->code = intval($e->getCode());
330 330
         
331
-        if(!isset($_REQUEST) || !isset($_REQUEST['REQUEST_URI'])) {
331
+        if (!isset($_REQUEST) || !isset($_REQUEST['REQUEST_URI'])) {
332 332
             $this->context = self::CONTEXT_COMMAND_LINE;
333 333
         }
334 334
         
335 335
         $previous = $e->getPrevious();
336
-        if(!empty($previous)) {
336
+        if (!empty($previous)) {
337 337
             $this->previous = ConvertHelper::throwable2info($previous);
338 338
         }
339 339
         
340
-        if(isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
340
+        if (isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
341 341
             $this->referer = $_SERVER['REQUEST_URI'];
342 342
         }
343 343
         
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         
352 352
         $idx = 1;
353 353
         
354
-        foreach($trace as $entry)
354
+        foreach ($trace as $entry)
355 355
         {
356 356
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromTrace($this, $idx, $entry);
357 357
             
Please login to merge, or discard this patch.
src/FileHelper/FileFinder.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @see FileHelper_FileFinder
8 8
  */
9 9
 
10
-declare(strict_types = 1);
10
+declare(strict_types=1);
11 11
 
12 12
 namespace AppUtils;
13 13
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     
126 126
     public function getAll() : array
127 127
     {
128
-        if(!isset($this->found)) {
128
+        if (!isset($this->found)) {
129 129
             $this->find($this->path, true);
130 130
         }
131 131
         
@@ -150,25 +150,25 @@  discard block
 block discarded – undo
150 150
     
151 151
     protected $found;
152 152
     
153
-    protected function find($path, $isRoot=false)
153
+    protected function find($path, $isRoot = false)
154 154
     {
155
-        if($isRoot) {
155
+        if ($isRoot) {
156 156
             $this->found = array();
157 157
         }
158 158
         
159 159
         $d = new \DirectoryIterator($path);
160
-        foreach($d as $item)
160
+        foreach ($d as $item)
161 161
         {
162
-            if($item->isDir())
162
+            if ($item->isDir())
163 163
             {
164
-                if($this->getOption('recursive') === true && !$item->isDot()) {
164
+                if ($this->getOption('recursive') === true && !$item->isDot()) {
165 165
                     $this->find($item->getPathname());
166 166
                 }
167 167
             }
168 168
             else
169 169
             {
170 170
                 $file = $this->filterFile($item->getPathname());
171
-                if($file) {
171
+                if ($file) {
172 172
                     $this->found[] = $file;
173 173
                 }
174 174
             }
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
         $include = $this->getOption('include-extensions');
185 185
         $exclude = $this->getOption('exclude-extensions');
186 186
         
187
-        if(!empty($include))
187
+        if (!empty($include))
188 188
         {
189
-            if(!in_array($info['extension'], $include)) {
189
+            if (!in_array($info['extension'], $include)) {
190 190
                 return false;
191 191
             }
192 192
         }
193
-        else if(!empty($exclude))
193
+        else if (!empty($exclude))
194 194
         {
195
-            if(in_array($info['extension'], $exclude)) {
195
+            if (in_array($info['extension'], $exclude)) {
196 196
                 return false;
197 197
             }
198 198
         }
199 199
         
200
-        switch($this->getOption('pathmode'))
200
+        switch ($this->getOption('pathmode'))
201 201
         {
202 202
             case self::PATH_MODE_STRIP:
203 203
                 $path = basename($path);
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
                 break;
214 214
         }
215 215
         
216
-        if($this->getOption('strip-extensions') === true)
216
+        if ($this->getOption('strip-extensions') === true)
217 217
         {
218 218
             $path = str_replace('.'.$info['extension'], '', $path);
219 219
         }
220 220
         
221 221
         $replace = $this->getOption('slash-replacement');
222
-        if(!empty($replace)) {
222
+        if (!empty($replace)) {
223 223
             $path = str_replace('/', $replace, $path);
224 224
         }
225 225
         
Please login to merge, or discard this patch.
src/BaseException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     * @param int $code
32 32
     * @param \Exception $previous
33 33
     */
34
-    public function __construct(string $message, $details=null, $code=null, $previous=null)
34
+    public function __construct(string $message, $details = null, $code = null, $previous = null)
35 35
     {
36 36
         parent::__construct($message, $code, $previous);
37 37
         
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     */
45 45
     public function getDetails() : string
46 46
     {
47
-        if($this->details !== null) {
47
+        if ($this->details !== null) {
48 48
             return $this->details;
49 49
         }
50 50
         
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     */
58 58
     public function display()
59 59
     {
60
-        if(!headers_sent()) {
60
+        if (!headers_sent()) {
61 61
             header('Content-type:text/plain; charset=utf-8');
62 62
         }
63 63
         
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         {
86 86
             throw new BaseException('');
87 87
         }
88
-        catch(BaseException $e) 
88
+        catch (BaseException $e) 
89 89
         {
90 90
             echo self::createInfo($e)->toString();
91 91
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         {
101 101
             throw new BaseException('');
102 102
         }
103
-        catch(BaseException $e)
103
+        catch (BaseException $e)
104 104
         {
105 105
             echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">';
106 106
             echo self::createInfo($e)->toString();
Please login to merge, or discard this patch.
src/NumberInfo.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function setValue($value) : NumberInfo
86 86
     {
87
-        if($value instanceof NumberInfo) {
87
+        if ($value instanceof NumberInfo) {
88 88
             $value = $value->getValue();
89 89
         }
90 90
         
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     
118 118
     public function isPositive() : bool
119 119
     {
120
-        if(!$this->isEmpty()) {
120
+        if (!$this->isEmpty()) {
121 121
             $number = $this->getNumber();
122 122
             return $number > 0;
123 123
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function hasValue() : bool
150 150
     {
151
-        if(!$this->isEmpty() && !$this->isZero()) {
151
+        if (!$this->isEmpty() && !$this->isZero()) {
152 152
             return true;
153 153
         }
154 154
         
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function getUnits()
223 223
     {
224
-        if(!$this->hasUnits()) {
224
+        if (!$this->hasUnits()) {
225 225
             return 'px';
226 226
         }
227 227
         
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public function toAttribute()
257 257
     {
258
-        if($this->isEmpty()) {
258
+        if ($this->isEmpty()) {
259 259
             return null;
260 260
         }
261 261
         
262
-        if($this->isZero()) {
262
+        if ($this->isZero()) {
263 263
             return '0';
264 264
         }
265 265
         
266
-        if($this->isPercent()) {
266
+        if ($this->isPercent()) {
267 267
             return $this->getNumber().$this->getUnits();
268 268
         }
269 269
         
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public function toCSS()
278 278
     {
279
-        if($this->isEmpty()) {
279
+        if ($this->isEmpty()) {
280 280
             return null;
281 281
         }
282 282
         
283
-        if($this->isZero()) {
283
+        if ($this->isZero()) {
284 284
             return '0';
285 285
         }
286 286
         
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     
290 290
     public function __toString()
291 291
     {
292
-        if($this->isEmpty()) {
292
+        if ($this->isEmpty()) {
293 293
             return '';
294 294
         }
295 295
         
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     public function isBiggerThan($number)
308 308
     {
309 309
         $number = parseNumber($number);
310
-        if($number->getUnits() != $this->getUnits()) {
310
+        if ($number->getUnits() != $this->getUnits()) {
311 311
             return false;
312 312
         }
313 313
         
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     public function isSmallerThan($number)
326 326
     {
327 327
         $number = parseNumber($number);
328
-        if($number->getUnits() != $this->getUnits()) {
328
+        if ($number->getUnits() != $this->getUnits()) {
329 329
             return false;
330 330
         }
331 331
         
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     public function isBiggerEqual($number)
336 336
     {
337 337
         $number = parseNumber($number);
338
-        if($number->getUnits() != $this->getUnits()) {
338
+        if ($number->getUnits() != $this->getUnits()) {
339 339
             return false;
340 340
         }
341 341
         
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
      */
353 353
     public function add($value)
354 354
     {
355
-        if($this->isEmpty()) {
355
+        if ($this->isEmpty()) {
356 356
             $this->setValue($value);
357 357
             return $this;
358 358
         }
359 359
         
360 360
         $number = parseNumber($value);
361 361
         
362
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
362
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
363 363
         {
364 364
             $new = $this->getNumber() + $number->getNumber();
365 365
             $this->setValue($new.$this->getUnits());
@@ -378,14 +378,14 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function subtract($value)
380 380
     {
381
-        if($this->isEmpty()) {
381
+        if ($this->isEmpty()) {
382 382
             $this->setValue($value);
383 383
             return $this;
384 384
         }
385 385
         
386 386
         $number = parseNumber($value);
387 387
         
388
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
388
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
389 389
         {
390 390
             $new = $this->getNumber() - $number->getNumber();
391 391
             $this->setValue($new.$this->getUnits());
@@ -412,25 +412,25 @@  discard block
 block discarded – undo
412 412
     
413 413
     protected function percentOperation($operation, $percent)
414 414
     {
415
-        if($this->isZeroOrEmpty()) {
415
+        if ($this->isZeroOrEmpty()) {
416 416
             return $this;
417 417
         }
418 418
         
419 419
         $percent = parseNumber($percent);
420
-        if($percent->hasUnits() && !$percent->isPercent()) {
420
+        if ($percent->hasUnits() && !$percent->isPercent()) {
421 421
             return $this;
422 422
         }
423 423
         
424 424
         $number = $this->getNumber();
425 425
         $value = $number * $percent->getNumber() / 100;
426 426
         
427
-        if($operation == '-') {
427
+        if ($operation == '-') {
428 428
             $number = $number - $value;
429 429
         } else {
430 430
             $number = $number + $value;
431 431
         }
432 432
         
433
-        if($this->isUnitInteger()) {
433
+        if ($this->isUnitInteger()) {
434 434
             $number = intval($number);
435 435
         }
436 436
         
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
     {
480 480
         static $cache = array();
481 481
         
482
-        if(!is_string($value) && !is_numeric($value)) 
482
+        if (!is_string($value) && !is_numeric($value)) 
483 483
         {
484 484
             $value = '';
485 485
             $key = '_EMPTY_';
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $key = (string)$value;
490 490
         }
491 491
 
492
-        if(array_key_exists($key, $cache)) {
492
+        if (array_key_exists($key, $cache)) {
493 493
             return $cache[$key];
494 494
         }
495 495
         
@@ -499,31 +499,31 @@  discard block
 block discarded – undo
499 499
             'number' => null
500 500
         );
501 501
         
502
-        if($value === '') {
502
+        if ($value === '') {
503 503
             $cache[$key]['empty'] = true;
504 504
             return $cache[$key];
505 505
         }
506 506
         
507
-        if($value === 0 || $value === '0') {
507
+        if ($value === 0 || $value === '0') {
508 508
             $cache[$key]['number'] = 0;
509 509
             $cache[$key] = $this->filterInfo($cache[$key]);
510 510
             return $cache[$key];
511 511
         }
512 512
         
513 513
         $test = trim((string)$value);
514
-        if($test === '') {
514
+        if ($test === '') {
515 515
             $cache[$key]['empty'] = true;
516 516
             return $cache[$key];
517 517
         }
518 518
         
519 519
         // replace comma notation (which is only possible if it's a string)
520
-        if(is_string($value))
520
+        if (is_string($value))
521 521
         {
522 522
             $test = $this->preProcess($test, $cache, $value);
523 523
         }
524 524
         
525 525
         // convert to a number if it's numeric
526
-        if(is_numeric($test)) {
526
+        if (is_numeric($test)) {
527 527
             $cache[$key]['number'] = $test * 1;
528 528
             $cache[$key] = $this->filterInfo($cache[$key]);
529 529
             return $cache[$key];
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
         
537 537
         $vlength = strlen($test);
538 538
         $names = array_keys($this->knownUnits);
539
-        foreach($names as $unit)
539
+        foreach ($names as $unit)
540 540
         {
541 541
             $ulength = strlen($unit);
542
-            $start = $vlength-$ulength;
543
-            if($start < 0) {
542
+            $start = $vlength - $ulength;
543
+            if ($start < 0) {
544 544
                 continue;
545 545
             }
546 546
             
547 547
             $search = substr($test, $start, $ulength);
548
-            if($search==$unit) {
548
+            if ($search == $unit) {
549 549
                 $units = $unit;
550 550
                 $number = substr($test, 0, $start);
551 551
                 break;
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
         }
554 554
         
555 555
         // the filters have to restore the value
556
-        if($this->postProcess)
556
+        if ($this->postProcess)
557 557
         {
558 558
             $number = $this->postProcess($number, $test);
559 559
         }
560 560
         // empty number
561
-        else if($number === '' || $number === null || is_bool($number))
561
+        else if ($number === '' || $number === null || is_bool($number))
562 562
         {
563 563
             $number = null;
564 564
             $cache[$key]['empty'] = true;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
             $number = trim($number);
570 570
             
571 571
             // may be an arbitrary string in some cases
572
-            if(!is_numeric($number))
572
+            if (!is_numeric($number))
573 573
             {
574 574
                 $number = null;
575 575
                 $cache[$key]['empty'] = true;
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
     protected function filterInfo(array $info) : array
649 649
     {
650 650
         $useUnits = 'px';
651
-        if($info['units'] !== null) {
651
+        if ($info['units'] !== null) {
652 652
             $useUnits = $info['units'];
653 653
         }
654 654
         
655 655
         // the units are non-decimal: convert decimal values
656
-        if($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
656
+        if ($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
657 657
         {
658 658
             $info['number'] = intval($info['number']);
659 659
         }
Please login to merge, or discard this patch.
src/IniHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $section = $this->addSection(self::SECTION_DEFAULT);
37 37
         
38
-        if(empty($iniString)) {
38
+        if (empty($iniString)) {
39 39
             return;
40 40
         }
41 41
         
42 42
         $eol = ConvertHelper::detectEOLCharacter($iniString);
43
-        if($eol !== null) {
43
+        if ($eol !== null) {
44 44
             $this->eol = $eol->getCharacter();
45 45
         }
46 46
         
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         
49 49
         $total = count($lines);
50 50
         
51
-        for($i=0; $i < $total; $i++) 
51
+        for ($i = 0; $i < $total; $i++) 
52 52
         {
53 53
             $line = new IniHelper_Line($lines[$i], $i);
54 54
             
55
-            if($line->isSection()) {
55
+            if ($line->isSection()) {
56 56
                 $section = $this->addSection($line->getSectionName());
57 57
             }
58 58
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $iniPath = FileHelper::requireFileExists($iniPath);
83 83
         
84 84
         $content = file_get_contents($iniPath);
85
-        if($content !== false) {
85
+        if ($content !== false) {
86 86
             return self::createFromString($content);
87 87
         }
88 88
         
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     */
128 128
     public function addSection(string $name) : IniHelper_Section
129 129
     {
130
-        if(!isset($this->sections[$name])) {
130
+        if (!isset($this->sections[$name])) {
131 131
             $this->sections[$name] = new IniHelper_Section($this, $name);
132 132
         }
133 133
         
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     */
143 143
     public function getSection(string $name) : ?IniHelper_Section
144 144
     {
145
-        if(isset($this->sections[$name])) {
145
+        if (isset($this->sections[$name])) {
146 146
             return $this->sections[$name];
147 147
         }
148 148
         
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $result = array();
160 160
         
161
-        foreach($this->sections as $section)
161
+        foreach ($this->sections as $section)
162 162
         {
163
-            if($section->isDefault()) 
163
+            if ($section->isDefault()) 
164 164
             {
165 165
                 $result = array_merge($result, $section->toArray());
166 166
             } 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     {
201 201
         $parts = array();
202 202
         
203
-        foreach($this->sections as $section)
203
+        foreach ($this->sections as $section)
204 204
         {
205 205
             $parts[] = $section->toString();
206 206
         }
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
     */
244 244
     public function sectionExists(string $name) : bool
245 245
     {
246
-        foreach($this->sections as $section) {
247
-            if($section->getName() === $name) {
246
+        foreach ($this->sections as $section) {
247
+            if ($section->getName() === $name) {
248 248
                 return true;
249 249
             }
250 250
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     {
274 274
         $path = $this->parsePath($path);
275 275
         
276
-        if(!$this->sectionExists($path['section'])) {
276
+        if (!$this->sectionExists($path['section'])) {
277 277
             return array();
278 278
         }
279 279
         
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     {
285 285
         $path = explode($this->pathSeparator, $path);
286 286
         
287
-        if(count($path) === 1)
287
+        if (count($path) === 1)
288 288
         {
289 289
             return array(
290 290
                 'section' => self::SECTION_DEFAULT,
Please login to merge, or discard this patch.
src/VariableInfo.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
     * @param mixed $value
52 52
     * @param array|null $serialized
53 53
     */
54
-    public function __construct($value, $serialized=null)
54
+    public function __construct($value, $serialized = null)
55 55
     {
56
-        if(is_array($serialized))
56
+        if (is_array($serialized))
57 57
         {
58 58
             $this->parseSerialized($serialized);
59 59
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $this->value = $value;
102 102
         $this->type = strtolower(gettype($value));
103 103
         
104
-        if(is_array($value) && is_callable($value)) {
104
+        if (is_array($value) && is_callable($value)) {
105 105
             $this->type = self::TYPE_CALLABLE;
106 106
         }
107 107
         
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     * @param bool $enable
135 135
     * @return VariableInfo
136 136
     */
137
-    public function enableType(bool $enable=true) : VariableInfo
137
+    public function enableType(bool $enable = true) : VariableInfo
138 138
     {
139 139
         return $this->setOption('prepend-type', $enable);
140 140
     }
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $converted = $this->string;
145 145
         
146
-        if($this->getOption('prepend-type') === true && !$this->isNull())
146
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
147 147
         {
148
-            if($this->isString())
148
+            if ($this->isString())
149 149
             {
150 150
                 $converted = '"'.$converted.'"';
151 151
             }
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
         
178 178
         $converted = $this->$varMethod();
179 179
         
180
-        if($format === 'HTML')
180
+        if ($format === 'HTML')
181 181
         {
182 182
             $converted = '<span style="color:#'.self::$colors[$type].'" class="variable-value-'.$this->type.'">'.$converted.'</span>';
183 183
         }
184 184
         
185
-        if($this->getOption('prepend-type') === true && !$this->isNull()) 
185
+        if ($this->getOption('prepend-type') === true && !$this->isNull()) 
186 186
         {
187 187
             $typeLabel = $type;
188 188
             
189
-            switch($format)
189
+            switch ($format)
190 190
             {
191 191
                 case 'HTML':
192 192
                     $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$type.'</span> ';
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         
216 216
         // the array may not be encodable - for example if it contains
217 217
         // broken unicode characters. 
218
-        if(is_string($result) && $result !== '') {
218
+        if (is_string($result) && $result !== '') {
219 219
             return $result;
220 220
         }
221 221
         
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $string = '';
228 228
         
229
-        if(is_string($this->value[0])) {
229
+        if (is_string($this->value[0])) {
230 230
             $string .= $this->value[0].'::';
231 231
         } else {
232 232
             $string .= get_class($this->value[0]).'->';
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             str_replace(' ', '-', $this->type)
354 354
         );
355 355
         
356
-        if($this->getOption('prepend-type') === true && !$this->isNull())
356
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
357 357
         {
358 358
             $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->type.'</span> ';
359 359
             $converted = $typeLabel.' '.$converted;
Please login to merge, or discard this patch.
src/JSHelper.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
         $quoteStyle = array_shift($params);
96 96
         $method = array_shift($params);
97 97
         
98
-        $call = $method . '(';
98
+        $call = $method.'(';
99 99
         
100 100
         $total = count($params);
101
-        if($total > 0) {
102
-            for($i=0; $i < $total; $i++) 
101
+        if ($total > 0) {
102
+            for ($i = 0; $i < $total; $i++) 
103 103
             {
104 104
                 $call .= self::phpVariable2JS($params[$i], $quoteStyle);
105
-                if($i < ($total-1)) {
105
+                if ($i < ($total - 1)) {
106 106
                     $call .= ',';
107 107
                 }
108 108
             }
109 109
         }
110 110
         
111
-        return $call . ');';
111
+        return $call.');';
112 112
     }
113 113
 
114 114
    /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     */
133 133
     public static function buildVariable(string $varName, $varValue) : string
134 134
     {
135
-        return $varName . "=" . self::phpVariable2JS($varValue) . ';';
135
+        return $varName."=".self::phpVariable2JS($varValue).';';
136 136
     }
137 137
     
138 138
    /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     * @param int $quoteStyle The quote style to use for strings
145 145
     * @return string
146 146
     */
147
-    public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string
147
+    public static function phpVariable2JS($variable, int $quoteStyle = self::QUOTE_STYLE_DOUBLE) : string
148 148
     {
149 149
         // after much profiling, this variant of the method offers
150 150
         // the best performance. Repeat scalar values are cached 
@@ -152,22 +152,22 @@  discard block
 block discarded – undo
152 152
         
153 153
         $type = gettype($variable);
154 154
         $hash = null;
155
-        if(is_scalar($variable) === true) 
155
+        if (is_scalar($variable) === true) 
156 156
         {
157 157
             $hash = $variable;
158 158
         
159
-            if($hash === true) 
159
+            if ($hash === true) 
160 160
             { 
161 161
                 $hash = 'true'; 
162 162
             } 
163
-            else if($hash === false) 
163
+            else if ($hash === false) 
164 164
             { 
165 165
                 $hash = 'false'; 
166 166
             }
167 167
             
168 168
             $hash .= '-'.$quoteStyle.'-'.$type;
169 169
             
170
-            if(isset(self::$variableCache[$hash])) {
170
+            if (isset(self::$variableCache[$hash])) {
171 171
                 return self::$variableCache[$hash];
172 172
             }
173 173
         }
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
         $result = 'null';
176 176
 
177 177
         // one gettype call is better than a strict if-else.
178
-        switch($type) 
178
+        switch ($type) 
179 179
         {
180 180
             case 'double':
181 181
             case 'string':
182 182
                 $string = json_encode($variable);
183 183
                 
184
-                if($string === false) 
184
+                if ($string === false) 
185 185
                 {
186 186
                     $string = '';
187 187
                 } 
188
-                else if($quoteStyle === self::QUOTE_STYLE_SINGLE) 
188
+                else if ($quoteStyle === self::QUOTE_STYLE_SINGLE) 
189 189
                 {
190
-                    $string = mb_substr($string, 1, mb_strlen($string)-2);
190
+                    $string = mb_substr($string, 1, mb_strlen($string) - 2);
191 191
                     $string = "'".str_replace("'", "\'", $string)."'";
192 192
                 }
193 193
                 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 break;
196 196
                 
197 197
             case 'boolean':
198
-                if($variable === true) {
198
+                if ($variable === true) {
199 199
                     $result = 'true';
200 200
                 } else {
201 201
                     $result = 'false';
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         }
214 214
 
215 215
         // cache cacheable values
216
-        if($hash !== null) 
216
+        if ($hash !== null) 
217 217
         {
218 218
             self::$variableCache[$hash] = $result;
219 219
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         self::$elementCounter++;
247 247
 
248
-        return self::$idPrefix . self::$elementCounter;
248
+        return self::$idPrefix.self::$elementCounter;
249 249
     }
250 250
     
251 251
    /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * @see JSHelper::JS_REGEX_OBJECT
320 320
      * @see JSHelper::JS_REGEX_JSON
321 321
      */
322
-    public static function buildRegexStatement(string $regex, string $statementType=self::JS_REGEX_OBJECT) : string
322
+    public static function buildRegexStatement(string $regex, string $statementType = self::JS_REGEX_OBJECT) : string
323 323
     {
324 324
         $regex = trim($regex);
325 325
         $separator = substr($regex, 0, 1);
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         array_shift($parts);
328 328
         
329 329
         $modifiers = array_pop($parts);
330
-        if($modifiers == $separator) {
330
+        if ($modifiers == $separator) {
331 331
             $modifiers = '';
332 332
         }
333 333
         
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         // convert the anchors that are not supported in js regexes
344 344
         $format = str_replace(array('\\A', '\\Z', '\\z'), array('^', '$', ''), $format);
345 345
         
346
-        if($statementType==self::JS_REGEX_JSON)
346
+        if ($statementType == self::JS_REGEX_JSON)
347 347
         {
348 348
             return ConvertHelper::var2json(array(
349 349
                 'format' => $format,
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             ));
352 352
         }
353 353
         
354
-        if(!empty($modifiers)) {
354
+        if (!empty($modifiers)) {
355 355
             return sprintf(
356 356
                 'new RegExp(%s, %s)',
357 357
                 ConvertHelper::var2json($format),
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
     public function getParam($name, $default = null)
91 91
     {
92 92
         $value = $default;
93
-        if(isset($_REQUEST[$name])) {
93
+        if (isset($_REQUEST[$name])) {
94 94
             $value = $_REQUEST[$name];
95 95
         }
96 96
         
97
-        if(isset($this->knownParams[$name])) {
97
+        if (isset($this->knownParams[$name])) {
98 98
             $value = $this->knownParams[$name]->validate($value);
99 99
         }
100 100
         
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
     
138 138
     public function getRefreshParams($params = array(), $exclude = array())
139 139
     {
140
-        if(empty($params)) { $params = array(); }
141
-        if(empty($exclude)) { $exclude = array(); }
140
+        if (empty($params)) { $params = array(); }
141
+        if (empty($exclude)) { $exclude = array(); }
142 142
         
143 143
         $vars = $_REQUEST;
144 144
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         // remove the quickform form variable if present, to 
159 159
         // avoid redirect loops when using the refresh URL in
160 160
         // a page in which a form has been submitted.
161
-        foreach($names as $name) {
162
-            if(strstr($name, '_qf__')) {
161
+        foreach ($names as $name) {
162
+            if (strstr($name, '_qf__')) {
163 163
                 unset($vars[$name]);
164 164
                 break;
165 165
             }
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
      * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed.
187 187
      * @return string
188 188
      */
189
-    public function buildURL($params = array(), string $dispatcher='')
189
+    public function buildURL($params = array(), string $dispatcher = '')
190 190
     {
191
-        $url = rtrim($this->getBaseURL(), '/') . '/' . $dispatcher;
191
+        $url = rtrim($this->getBaseURL(), '/').'/'.$dispatcher;
192 192
         
193 193
         // append any leftover parameters to the end of the URL
194 194
         if (!empty($params)) {
195
-            $url .= '?' . http_build_query($params, null, '&amp;');
195
+            $url .= '?'.http_build_query($params, null, '&amp;');
196 196
         }
197 197
         
198 198
         return $url;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function registerParam($name)
225 225
     {
226
-        if(!isset($this->knownParams[$name])) {
226
+        if (!isset($this->knownParams[$name])) {
227 227
             $param = new Request_Param($this, $name);
228 228
             $this->knownParams[$name] = $param;
229 229
         }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     */
241 241
     public function getRegisteredParam(string $name) : Request_Param
242 242
     {
243
-        if(isset($this->knownParams[$name])) {
243
+        if (isset($this->knownParams[$name])) {
244 244
             return $this->knownParams[$name];
245 245
         }
246 246
         
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
             {
308 308
                 $entry['type'] = $matches[1];
309 309
                 
310
-                if(isset($matches[2]) && !empty($matches[2])) 
310
+                if (isset($matches[2]) && !empty($matches[2])) 
311 311
                 {
312 312
                     $params = ConvertHelper::parseQueryString($matches[2]);
313 313
                     $entry['params'] = $params;
314 314
                      
315
-                    if(isset($params['q'])) {
315
+                    if (isset($params['q'])) {
316 316
                         $entry['quality'] = (double)$params['q'];
317 317
                     }
318 318
                 }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $_REQUEST[$name] = $value;
367 367
         
368
-        if(isset($this->knownParams[$name])) {
368
+        if (isset($this->knownParams[$name])) {
369 369
             unset($this->knownParams[$name]);
370 370
         }
371 371
         
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
     */
400 400
     public function removeParam(string $name) : Request
401 401
     {
402
-        if(isset($_REQUEST[$name])) {
402
+        if (isset($_REQUEST[$name])) {
403 403
             unset($_REQUEST[$name]);
404 404
         }
405 405
         
406
-        if(isset($this->knownParams[$name])) {
406
+        if (isset($this->knownParams[$name])) {
407 407
             unset($this->knownParams[$name]);
408 408
         }
409 409
         
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     */
419 419
     public function removeParams(array $names) : Request
420 420
     {
421
-        foreach($names as $name) {
421
+        foreach ($names as $name) {
422 422
             $this->removeParam($name);
423 423
         }
424 424
         
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
      * @param string $name
435 435
      * @return bool
436 436
      */
437
-    public function getBool($name, $default=false)
437
+    public function getBool($name, $default = false)
438 438
     {
439 439
         $value = $this->getParam($name, $default);
440
-        if(ConvertHelper::isBoolean($value)) {
440
+        if (ConvertHelper::isBoolean($value)) {
441 441
             return ConvertHelper::string2bool($value);
442 442
         }
443 443
         
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
     
447 447
     public function validate()
448 448
     {
449
-        foreach($this->knownParams as $param) {
449
+        foreach ($this->knownParams as $param) {
450 450
             $name = $param->getName();
451
-            if($param->isRequired() && !$this->hasParam($name)) {
451
+            if ($param->isRequired() && !$this->hasParam($name)) {
452 452
                 throw new Request_Exception(
453 453
                     'Missing request parameter '.$name,
454 454
                     sprintf(
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
      * @param mixed $default
471 471
      * @return string
472 472
      */
473
-    public function getFilteredParam($name, $default=null)
473
+    public function getFilteredParam($name, $default = null)
474 474
     {
475 475
         $val = $this->getParam($name, $default);
476
-        if(is_string($val)) {
476
+        if (is_string($val)) {
477 477
             $val = htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8');
478 478
         }
479 479
         
@@ -492,24 +492,24 @@  discard block
 block discarded – undo
492 492
     * @see Request::getJSONAssoc()
493 493
     * @see Request::getJSONObject()
494 494
     */
495
-    public function getJSON(string $name, bool $assoc=true)
495
+    public function getJSON(string $name, bool $assoc = true)
496 496
     {
497 497
         $value = $this->getParam($name);
498 498
         
499
-        if(!empty($value) && is_string($value)) 
499
+        if (!empty($value) && is_string($value)) 
500 500
         {
501 501
             $data = json_decode($value, $assoc);
502 502
             
503
-            if($assoc && is_array($data)) {
503
+            if ($assoc && is_array($data)) {
504 504
                 return $data;
505 505
             }
506 506
             
507
-            if(is_object($data)) {
507
+            if (is_object($data)) {
508 508
                 return $data;
509 509
             }
510 510
         }
511 511
         
512
-        if($assoc) {
512
+        if ($assoc) {
513 513
             return array();
514 514
         }
515 515
         
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
     public function getJSONAssoc(string $name) : array
527 527
     {
528 528
         $result = $this->getJSON($name);
529
-        if(is_array($result)) {
529
+        if (is_array($result)) {
530 530
             return $result;
531 531
         }
532 532
         
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     public function getJSONObject(string $name) : object
544 544
     {
545 545
         $result = $this->getJSON($name, false);
546
-        if(is_object($result)) {
546
+        if (is_object($result)) {
547 547
             return $result;
548 548
         }
549 549
         
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
     * @param array|string $data
557 557
     * @param bool $exit Whether to exit the script afterwards.
558 558
     */
559
-    public static function sendJSON($data, bool $exit=true)
559
+    public static function sendJSON($data, bool $exit = true)
560 560
     {
561 561
         $payload = $data;
562
-        if(!is_string($payload)) {
562
+        if (!is_string($payload)) {
563 563
             $payload = json_encode($payload);
564 564
         }
565 565
         
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         
570 570
         echo $payload;
571 571
         
572
-        if($exit) 
572
+        if ($exit) 
573 573
         {
574 574
             exit;
575 575
         }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     * @param string $html
582 582
     * @param bool $exit Whether to exit the script afterwards.
583 583
     */
584
-    public static function sendHTML(string $html, bool $exit=true)
584
+    public static function sendHTML(string $html, bool $exit = true)
585 585
     {
586 586
         header('Cache-Control: no-cache, must-revalidate');
587 587
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         
590 590
         echo $html;
591 591
         
592
-        if($exit)
592
+        if ($exit)
593 593
         {
594 594
             exit;
595 595
         }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
606 606
     * @return Request_URLComparer
607 607
     */
608
-    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
608
+    public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer
609 609
     {
610 610
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
611 611
         $comparer->addLimitParams($limitParams);
Please login to merge, or discard this patch.