Passed
Push — master ( e76473...8d6fb4 )
by Sebastian
09:39
created
src/FileHelper/FileInfo/LineReader.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 
48 48
         $file = new SplFileObject($this->file->getPath());
49 49
 
50
-        if($file->eof()) {
50
+        if ($file->eof()) {
51 51
             return '';
52 52
         }
53 53
 
54
-        $targetLine = $lineNumber-1;
54
+        $targetLine = $lineNumber - 1;
55 55
 
56 56
         $file->seek($targetLine);
57 57
 
58
-        if($file->key() !== $targetLine)
58
+        if ($file->key() !== $targetLine)
59 59
         {
60 60
             return null;
61 61
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $number = $spl->key();
77 77
 
78 78
         // if seeking to the end the cursor is still at 0, there are no lines.
79
-        if($number === 0)
79
+        if ($number === 0)
80 80
         {
81 81
             // since it's a very small file, to get reliable results,
82 82
             // we read its contents and use that to determine what
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
             // that this is not practical to solve with the SplFileObject.
85 85
             $content = file_get_contents($path);
86 86
 
87
-            if(empty($content)) {
87
+            if (empty($content)) {
88 88
                 return 0;
89 89
             }
90 90
         }
91 91
 
92 92
         // return the line number we were able to reach + 1 (key is zero-based)
93
-        return $number+1;
93
+        return $number + 1;
94 94
     }
95 95
 
96 96
     /**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
      * @return string[]
99 99
      * @throws FileHelper_Exception
100 100
      */
101
-    public function getLines(int $amount=0) : array
101
+    public function getLines(int $amount = 0) : array
102 102
     {
103 103
         $this->file->requireExists();
104 104
 
105 105
         $fn = fopen($this->file->getPath(), 'rb');
106 106
 
107
-        if($fn === false)
107
+        if ($fn === false)
108 108
         {
109 109
             throw new FileHelper_Exception(
110 110
                 'Could not open file for reading.',
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
         $counter = 0;
121 121
         $first = true;
122 122
 
123
-        while(!feof($fn))
123
+        while (!feof($fn))
124 124
         {
125 125
             $counter++;
126 126
 
127 127
             $line = fgets($fn);
128 128
 
129 129
             // can happen with zero length files
130
-            if($line === false) {
130
+            if ($line === false) {
131 131
                 continue;
132 132
             }
133 133
 
134 134
             // the first line may contain a unicode BOM marker.
135
-            if($first)
135
+            if ($first)
136 136
             {
137 137
                 $line = ConvertHelper::stripUTFBom($line);
138 138
                 $first = false;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
             $result[] = $line;
142 142
 
143
-            if($amount > 0 && $counter === $amount) {
143
+            if ($amount > 0 && $counter === $amount) {
144 144
                 break;
145 145
             }
146 146
         }
Please login to merge, or discard this patch.
src/FileHelper/FileInfo/NameFixer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
49 49
 
50 50
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
51 51
 
52
-        while(strpos($name, '  ') !== false) {
52
+        while (strpos($name, '  ') !== false) {
53 53
             $name = str_replace('  ', ' ', $name);
54 54
         }
55 55
 
56 56
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
57 57
 
58
-        while(strpos($name, '..') !== false) {
58
+        while (strpos($name, '..') !== false) {
59 59
             $name = str_replace('..', '.', $name);
60 60
         }
61 61
 
Please login to merge, or discard this patch.
src/FileHelper/PathsReducer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param string[] $paths
37 37
      * @throws FileHelper_Exception
38 38
      */
39
-    public function __construct(array $paths=array())
39
+    public function __construct(array $paths = array())
40 40
     {
41 41
         $this->addPaths($paths);
42 42
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function addPaths(array $paths) : PathsReducer
51 51
     {
52
-        foreach($paths as $path) {
52
+        foreach ($paths as $path) {
53 53
             $this->addPath($path);
54 54
         }
55 55
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $path = FileHelper::normalizePath($path);
68 68
 
69
-        if(!in_array($path, $this->paths, true)) {
69
+        if (!in_array($path, $this->paths, true)) {
70 70
             $this->paths[] = $path;
71 71
         }
72 72
 
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $split = $this->splitPaths();
85 85
 
86
-        if(empty($split)) {
86
+        if (empty($split)) {
87 87
             return array();
88 88
         }
89 89
 
90
-        while($this->shiftPart($split) === true) {}
90
+        while ($this->shiftPart($split) === true) {}
91 91
 
92 92
         return $this->joinPaths($split);
93 93
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $result = array();
102 102
 
103 103
         foreach ($split as $entry) {
104
-            if(!empty($entry)) {
104
+            if (!empty($entry)) {
105 105
                 $result[] = implode('/', $entry);
106 106
             }
107 107
         }
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
         $current = null;
119 119
         $result = array();
120 120
 
121
-        foreach($split as $entry)
121
+        foreach ($split as $entry)
122 122
         {
123
-            if(empty($entry)) {
123
+            if (empty($entry)) {
124 124
                 return false;
125 125
             }
126 126
 
127 127
             $part = array_shift($entry);
128
-            if(empty($entry)) {
128
+            if (empty($entry)) {
129 129
                 return false;
130 130
             }
131 131
 
132
-            if($current === null) {
132
+            if ($current === null) {
133 133
                 $current = $part;
134 134
             }
135 135
 
136
-            if($part !== $current) {
136
+            if ($part !== $current) {
137 137
                 return false;
138 138
             }
139 139
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $split = array();
154 154
 
155
-        foreach($this->paths as $path) {
155
+        foreach ($this->paths as $path) {
156 156
             $entry = ConvertHelper::explodeTrim('/', $path);
157
-            if(!empty($entry)) {
157
+            if (!empty($entry)) {
158 158
                 $split[] = $entry;
159 159
             }
160 160
         }
Please login to merge, or discard this patch.
src/FileHelper/JSONFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     private function convertEncoding(string $contents) : string
126 126
     {
127
-        if(!empty($this->targetEncoding))
127
+        if (!empty($this->targetEncoding))
128 128
         {
129 129
             return mb_convert_encoding(
130 130
                 $contents,
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $options = null;
148 148
 
149
-        if($pretty)
149
+        if ($pretty)
150 150
         {
151 151
             $options = JSON_PRETTY_PRINT;
152 152
         }
Please login to merge, or discard this patch.
src/FileHelper/FileDownloader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function setTimeout(int $timeout) : FileDownloader
42 42
     {
43
-        if($timeout > 0)
43
+        if ($timeout > 0)
44 44
         {
45 45
             $this->timeout = $timeout;
46 46
         }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param bool $enabled
53 53
      * @return FileDownloader
54 54
      */
55
-    public function setSSLEnabled(bool $enabled=true) : FileDownloader
55
+    public function setSSLEnabled(bool $enabled = true) : FileDownloader
56 56
     {
57 57
         $this->SSLEnabled = $enabled;
58 58
         return $this;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         $output = curl_exec($ch);
75 75
 
76
-        if($output === false)
76
+        if ($output === false)
77 77
         {
78 78
             throw new FileHelper_Exception(
79 79
                 'Unable to open URL',
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         curl_close($ch);
90 90
 
91
-        if(is_string($output))
91
+        if (is_string($output))
92 92
         {
93 93
             return $output;
94 94
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $ch = curl_init();
110 110
 
111
-        if(!is_resource($ch))
111
+        if (!is_resource($ch))
112 112
         {
113 113
             throw new FileHelper_Exception(
114 114
                 'Could not initialize a new cURL instance.',
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
126 126
         curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
127 127
 
128
-        if(!$this->SSLEnabled)
128
+        if (!$this->SSLEnabled)
129 129
         {
130 130
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
131 131
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
Please login to merge, or discard this patch.
src/URLInfo.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     * @var array<string,string>|NULL
64 64
     * @see URLInfo::getTypeLabel()
65 65
     */
66
-    protected static ?array $typeLabels = null;
66
+    protected static ? array $typeLabels = null;
67 67
     
68 68
    /**
69 69
     * @var bool
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
     * @param bool $enabled
127 127
     * @return URLInfo
128 128
     */
129
-    public function setUTFEncoding(bool $enabled=true) : URLInfo
129
+    public function setUTFEncoding(bool $enabled = true) : URLInfo
130 130
     {
131
-        if($this->encodeUTFChars !== $enabled)
131
+        if ($this->encodeUTFChars !== $enabled)
132 132
         {
133 133
             $this->encodeUTFChars = $enabled;
134 134
             $this->parse(); // re-parse the URL to apply the changes
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $port = $this->getInfoKey('port');
234 234
         
235
-        if(!empty($port)) {
235
+        if (!empty($port)) {
236 236
             return (int)$port;
237 237
         }
238 238
         
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     
313 313
     protected function getInfoKey(string $name) : string
314 314
     {
315
-        if(isset($this->info[$name])) {
315
+        if (isset($this->info[$name])) {
316 316
             return (string)$this->info[$name];
317 317
         }
318 318
         
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
         return $this->normalize(false);
342 342
     }
343 343
     
344
-    protected function normalize(bool $auth=true) : string
344
+    protected function normalize(bool $auth = true) : string
345 345
     {
346
-        if(!$this->isValid()) {
346
+        if (!$this->isValid()) {
347 347
             return '';
348 348
         }
349 349
         
350
-        if(!isset($this->normalizer)) {
350
+        if (!isset($this->normalizer)) {
351 351
             $this->normalizer = new URLInfo_Normalizer($this);
352 352
         }
353 353
         
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     */
378 378
     public function getHighlighted() : string
379 379
     {
380
-        if(!$this->isValid()) {
380
+        if (!$this->isValid()) {
381 381
             return '';
382 382
         }
383 383
         
@@ -419,14 +419,14 @@  discard block
 block discarded – undo
419 419
     */
420 420
     public function getParams() : array
421 421
     {
422
-        if(!$this->paramExclusion || empty($this->excludedParams)) {
422
+        if (!$this->paramExclusion || empty($this->excludedParams)) {
423 423
             return $this->info['params'];
424 424
         }
425 425
         
426 426
         $keep = array();
427
-        foreach($this->info['params'] as $name => $value) 
427
+        foreach ($this->info['params'] as $name => $value) 
428 428
         {
429
-            if(!isset($this->excludedParams[$name])) {
429
+            if (!isset($this->excludedParams[$name])) {
430 430
                 $keep[$name] = $value;
431 431
             }
432 432
         }
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
     */
453 453
     public function getParam(string $name) : string
454 454
     {
455
-        if(isset($this->info['params'][$name])) {
455
+        if (isset($this->info['params'][$name])) {
456 456
             return $this->info['params'][$name];
457 457
         }
458 458
         
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
     * @param string $reason A human readable explanation why this is excluded - used when highlighting links.
470 470
     * @return URLInfo
471 471
     */
472
-    public function excludeParam(string $name, string $reason='') : URLInfo
472
+    public function excludeParam(string $name, string $reason = '') : URLInfo
473 473
     {
474
-        if(!isset($this->excludedParams[$name]))
474
+        if (!isset($this->excludedParams[$name]))
475 475
         {
476 476
             $this->excludedParams[$name] = $reason;
477 477
             $this->setParamExclusion();
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
     
498 498
     public function getTypeLabel() : string
499 499
     {
500
-        if(!isset(self::$typeLabels))
500
+        if (!isset(self::$typeLabels))
501 501
         {
502 502
             self::$typeLabels = array(
503 503
                 self::TYPE_EMAIL => t('Email'),
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         
510 510
         $type = $this->getType();
511 511
         
512
-        if(!isset(self::$typeLabels[$type]))
512
+        if (!isset(self::$typeLabels[$type]))
513 513
         {
514 514
             throw new BaseException(
515 515
                 sprintf('Unknown URL type label for type [%s].', $type),
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
     * @param bool $highlight
530 530
     * @return URLInfo
531 531
     */
532
-    public function setHighlightExcluded(bool $highlight=true) : URLInfo
532
+    public function setHighlightExcluded(bool $highlight = true) : URLInfo
533 533
     {
534 534
         $this->highlightExcluded = $highlight;
535 535
         return $this;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
      * @see URLInfo::isParamExclusionEnabled()
579 579
      * @see URLInfo::setHighlightExcluded()
580 580
      */
581
-    public function setParamExclusion(bool $enabled=true) : URLInfo
581
+    public function setParamExclusion(bool $enabled = true) : URLInfo
582 582
     {
583 583
         $this->paramExclusion = $enabled;
584 584
         return $this;
@@ -604,13 +604,13 @@  discard block
 block discarded – undo
604 604
     */
605 605
     public function containsExcludedParams() : bool
606 606
     {
607
-        if(empty($this->excludedParams)) {
607
+        if (empty($this->excludedParams)) {
608 608
             return false;
609 609
         }
610 610
         
611 611
         $names = array_keys($this->info['params']);
612
-        foreach($names as $name) {
613
-            if(isset($this->excludedParams[$name])) {
612
+        foreach ($names as $name) {
613
+            if (isset($this->excludedParams[$name])) {
614 614
                 return true;
615 615
             }
616 616
         }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     public function offsetSet($offset, $value) 
628 628
     {
629
-        if(in_array($offset, $this->infoKeys)) {
629
+        if (in_array($offset, $this->infoKeys)) {
630 630
             $this->info[$offset] = $value;
631 631
         }
632 632
     }
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
     
644 644
     public function offsetGet($offset)
645 645
     {
646
-        if($offset === 'port') {
646
+        if ($offset === 'port') {
647 647
             return $this->getPort();
648 648
         }
649 649
         
650
-        if(in_array($offset, $this->infoKeys)) {
650
+        if (in_array($offset, $this->infoKeys)) {
651 651
             return $this->getInfoKey($offset);
652 652
         }
653 653
         
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
     * @return bool
683 683
     * @throws BaseException
684 684
     */
685
-    public function tryConnect(bool $verifySSL=true) : bool
685
+    public function tryConnect(bool $verifySSL = true) : bool
686 686
     {
687 687
         return $this->createConnectionTester()
688 688
         ->setVerifySSL($verifySSL)
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
     */
726 726
     public function removeParam(string $param) : URLInfo
727 727
     {
728
-        if(isset($this->info['params'][$param]))
728
+        if (isset($this->info['params'][$param]))
729 729
         {
730 730
             unset($this->info['params'][$param]);
731 731
         }
Please login to merge, or discard this patch.
src/FileHelper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
     * @return Csv
198 198
      * @see CSVHelper::createParser()
199 199
     */
200
-    public static function createCSVParser(string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : Csv
200
+    public static function createCSVParser(string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : Csv
201 201
     {
202
-        if($delimiter==='') { $delimiter = ';'; }
203
-        if($enclosure==='') { $enclosure = '"'; }
202
+        if ($delimiter === '') { $delimiter = ';'; }
203
+        if ($enclosure === '') { $enclosure = '"'; }
204 204
 
205 205
         $parser = CSVHelper::createParser($delimiter);
206 206
         $parser->enclosure = $enclosure;
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
     * @see parseCSVFile()
225 225
     * @see FileHelper::ERROR_PARSING_CSV
226 226
     */
227
-    public static function parseCSVString(string $csv, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : array
227
+    public static function parseCSVString(string $csv, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : array
228 228
     {
229 229
         $parser = self::createCSVParser($delimiter, $enclosure, '\\', $heading);
230 230
 
231
-        if($parser->parse($csv))
231
+        if ($parser->parse($csv))
232 232
         {
233 233
             return $parser->data;
234 234
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
257 257
      * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
258 258
      */
259
-    public static function parseCSVFile(string $filePath, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : array
259
+    public static function parseCSVFile(string $filePath, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : array
260 260
     {
261 261
         return self::parseCSVString(
262 262
             self::readContents($filePath),
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     public static function detectMimeType(string $fileName) : ?string
278 278
     {
279 279
         $ext = self::getExtension($fileName);
280
-        if(empty($ext)) {
280
+        if (empty($ext)) {
281 281
             return null;
282 282
         }
283 283
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
318 318
      * @see FileHelper::ERROR_UNKNOWN_FILE_MIME_TYPE
319 319
      */
320
-    public static function sendFile(string $filePath, ?string $fileName = null, bool $asAttachment=true) : void
320
+    public static function sendFile(string $filePath, ?string $fileName = null, bool $asAttachment = true) : void
321 321
     {
322 322
         self::getFileInfo($filePath)->getDownloader()->send($fileName, $asAttachment);
323 323
     }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      * @throws FileHelper_Exception
335 335
      * @see FileHelper::ERROR_CANNOT_OPEN_URL
336 336
      */
337
-    public static function downloadFile(string $url, int $timeout=0, bool $SSLEnabled=false) : string
337
+    public static function downloadFile(string $url, int $timeout = 0, bool $SSLEnabled = false) : string
338 338
     {
339 339
         return FileDownloader::factory($url)
340 340
             ->setTimeout($timeout)
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $info = self::getPathInfo($pathOrDirIterator);
371 371
 
372
-        if($info instanceof FileInfo)
372
+        if ($info instanceof FileInfo)
373 373
         {
374 374
             return $info->getExtension($lowercase);
375 375
         }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     {
394 394
         $info = self::getPathInfo($pathOrDirIterator);
395 395
 
396
-        if($extension === true || $info instanceof FolderInfo)
396
+        if ($extension === true || $info instanceof FolderInfo)
397 397
         {
398 398
             return $info->getName();
399 399
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
      * @see FileHelper::ERROR_CANNOT_FIND_JSON_FILE
415 415
      * @see FileHelper::ERROR_CANNOT_DECODE_JSON_FILE
416 416
      */
417
-    public static function parseJSONFile(string $file, string $targetEncoding='', $sourceEncoding=null) : array
417
+    public static function parseJSONFile(string $file, string $targetEncoding = '', $sourceEncoding = null) : array
418 418
     {
419 419
         return JSONFile::factory(self::getFileInfo($file))
420 420
             ->setTargetEncoding($targetEncoding)
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @throws FileHelper_Exception
467 467
      * @see FileHelper::createFileFinder()
468 468
      */
469
-    public static function findHTMLFiles(string $targetFolder, array $options=array()) : array
469
+    public static function findHTMLFiles(string $targetFolder, array $options = array()) : array
470 470
     {
471 471
         return self::findFiles($targetFolder, array('html'), $options);
472 472
     }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
      * @throws FileHelper_Exception
485 485
      * @see FileHelper::createFileFinder()
486 486
      */
487
-    public static function findPHPFiles(string $targetFolder, array $options=array()) : array
487
+    public static function findPHPFiles(string $targetFolder, array $options = array()) : array
488 488
     {
489 489
         return self::findFiles($targetFolder, array('php'), $options);
490 490
     }
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     * @return string[]
504 504
     * @see FileHelper::createFileFinder()
505 505
     */
506
-    public static function findFiles(string $targetFolder, array $extensions=array(), array $options=array()) : array
506
+    public static function findFiles(string $targetFolder, array $extensions = array(), array $options = array()) : array
507 507
     {
508 508
         $finder = self::createFileFinder($targetFolder);
509 509
 
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
 
514 514
         $finder->setPathmodeStrip();
515 515
         
516
-        if(isset($options['relative-path']) && $options['relative-path'] === true) 
516
+        if (isset($options['relative-path']) && $options['relative-path'] === true) 
517 517
         {
518 518
             $finder->setPathmodeRelative();
519 519
         } 
520
-        else if(isset($options['absolute-path']) && $options['absolute-path'] === true)
520
+        else if (isset($options['absolute-path']) && $options['absolute-path'] === true)
521 521
         {
522 522
             $finder->setPathmodeAbsolute();
523 523
         }
524 524
         
525
-        if(isset($options['strip-extension'])) 
525
+        if (isset($options['strip-extension'])) 
526 526
         {
527 527
             $finder->stripExtensions();
528 528
         }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
     * @param bool $keepPath Whether to keep the path component, if any. Default PHP pathinfo behavior is not to.
541 541
     * @return string
542 542
     */
543
-    public static function removeExtension(string $filename, bool $keepPath=false) : string
543
+    public static function removeExtension(string $filename, bool $keepPath = false) : string
544 544
     {
545 545
         return self::getFileInfo($filename)->removeExtension($keepPath);
546 546
     }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 
616 616
     public static function createUnicodeHandling() : UnicodeHandling
617 617
     {
618
-        if(!isset(self::$unicodeHandling))
618
+        if (!isset(self::$unicodeHandling))
619 619
         {
620 620
             self::$unicodeHandling = new UnicodeHandling();
621 621
         }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
     * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
649 649
     * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
650 650
     */
651
-    public static function saveAsJSON($data, string $file, bool $pretty=false) : void
651
+    public static function saveAsJSON($data, string $file, bool $pretty = false) : void
652 652
     {
653 653
         JSONFile::factory(self::getFileInfo($file))
654 654
             ->putData($data, $pretty);
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
667 667
     * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
668 668
     */
669
-    public static function saveFile(string $filePath, string $content='') : void
669
+    public static function saveFile(string $filePath, string $content = '') : void
670 670
     {
671 671
         self::getFileInfo($filePath)->putContents($content);
672 672
     }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
      */
710 710
     public static function checkPHPFileSyntax(string $path)
711 711
     {
712
-        if(!self::canMakePHPCalls()) {
712
+        if (!self::canMakePHPCalls()) {
713 713
             return true;
714 714
         }
715 715
         
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         // when the validation is successful, the first entry
721 721
         // in the array contains the success message. When it
722 722
         // is invalid, the first entry is always empty.
723
-        if(!empty($output[0])) {
723
+        if (!empty($output[0])) {
724 724
             return true;
725 725
         }
726 726
         
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
     public static function getModifiedDate(string $path) : ?DateTime
742 742
     {
743 743
         $time = filemtime($path);
744
-        if($time === false) {
744
+        if ($time === false) {
745 745
             return null;
746 746
         }
747 747
 
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
816 816
         $size = floatval(preg_replace('/[^0-9\.]/', '', $size)); // Remove the non-numeric characters from the size.
817 817
         
818
-        if($unit) 
818
+        if ($unit) 
819 819
         {
820 820
             // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
821 821
             return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     * @param int $depth The folder depth to reduce the path to
835 835
     * @return string
836 836
     */
837
-    public static function relativizePathByDepth(string $path, int $depth=2) : string
837
+    public static function relativizePathByDepth(string $path, int $depth = 2) : string
838 838
     {
839 839
         $path = self::normalizePath($path);
840 840
         
@@ -842,17 +842,17 @@  discard block
 block discarded – undo
842 842
         $tokens = array_filter($tokens); // remove empty entries (trailing slash for example)
843 843
         $tokens = array_values($tokens); // re-index keys
844 844
         
845
-        if(empty($tokens)) {
845
+        if (empty($tokens)) {
846 846
             return '';
847 847
         }
848 848
         
849 849
         // remove the drive if present
850
-        if(strpos($tokens[0], ':') !== false) {
850
+        if (strpos($tokens[0], ':') !== false) {
851 851
             array_shift($tokens);
852 852
         }
853 853
         
854 854
         // path was only the drive
855
-        if(count($tokens) === 0) {
855
+        if (count($tokens) === 0) {
856 856
             return '';
857 857
         }
858 858
 
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
         
862 862
         // reduce the path to the specified depth
863 863
         $length = count($tokens);
864
-        if($length > $depth) {
865
-            $tokens = array_slice($tokens, $length-$depth);
864
+        if ($length > $depth) {
865
+            $tokens = array_slice($tokens, $length - $depth);
866 866
         }
867 867
 
868 868
         // append the last element again
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
     * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
911 911
     * @see FileHelper::ERROR_REAL_PATH_NOT_FOUND
912 912
     */
913
-    public static function requireFileExists($path, ?int $errorCode=null) : string
913
+    public static function requireFileExists($path, ?int $errorCode = null) : string
914 914
     {
915 915
         return self::getPathInfo($path)
916 916
             ->requireIsFile()
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
      * @return string
925 925
      * @throws FileHelper_Exception
926 926
      */
927
-    public static function requireFileReadable(string $path, ?int $errorCode=null) : string
927
+    public static function requireFileReadable(string $path, ?int $errorCode = null) : string
928 928
     {
929 929
         return self::getPathInfo($path)
930 930
             ->requireIsFile()
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
      * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
1011 1011
      * @see FileHelper::ERROR_CANNOT_OPEN_FILE_TO_READ_LINES
1012 1012
      */
1013
-    public static function readLines(string $filePath, int $amount=0) : array
1013
+    public static function readLines(string $filePath, int $amount = 0) : array
1014 1014
     {
1015 1015
         return self::getFileInfo($filePath)
1016 1016
             ->getLineReader()
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
      *
1061 1061
      * @throws FileHelper_Exception
1062 1062
      */
1063
-    public static function createPathsReducer(array $paths=array()) : PathsReducer
1063
+    public static function createPathsReducer(array $paths = array()) : PathsReducer
1064 1064
     {
1065 1065
         return new PathsReducer($paths);
1066 1066
     }
Please login to merge, or discard this patch.
src/Traits/AttributableTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
      * @param bool $enabled
75 75
      * @return $this
76 76
      */
77
-    public function prop(string $name, bool $enabled=true) : self
77
+    public function prop(string $name, bool $enabled = true) : self
78 78
     {
79 79
         $this->getAttributes()->prop($name, $enabled);
80 80
         return $this;
Please login to merge, or discard this patch.
src/Traits/Classable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function addClass($name)
43 43
     {
44
-        if(!in_array($name, $this->classes, true)) {
44
+        if (!in_array($name, $this->classes, true)) {
45 45
             $this->classes[] = $name;
46 46
         }
47 47
         
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function addClasses(array $names) : self
56 56
     {
57
-        foreach($names as $name) {
57
+        foreach ($names as $name) {
58 58
             $this->addClass($name);
59 59
         }
60 60
         
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $idx = array_search($name, $this->classes, true);
76 76
         
77
-        if($idx !== false) {
77
+        if ($idx !== false) {
78 78
             unset($this->classes[$idx]);
79 79
             sort($this->classes);
80 80
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     public function classesToAttribute() : string
110 110
     {
111
-        if(!empty($this->classes))
111
+        if (!empty($this->classes))
112 112
         {
113 113
             return sprintf(
114 114
                 ' class="%s" ',
Please login to merge, or discard this patch.