Passed
Push — master ( 6ea7df...684bcb )
by Sebastian
03:24
created
src/Highlighter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     public static function json($subject) : string
110 110
     {
111
-        if(!is_string($subject))
111
+        if (!is_string($subject))
112 112
         {
113 113
             $subject = json_encode($subject, JSON_PRETTY_PRINT);
114 114
         }
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     * @param bool $formatSource Whether to format the source with indentation to make it readable.
126 126
     * @return string
127 127
     */
128
-    public static function xml(string $xml, bool $formatSource=false) : string
128
+    public static function xml(string $xml, bool $formatSource = false) : string
129 129
     {
130
-        if($formatSource)
130
+        if ($formatSource)
131 131
         {
132 132
             $dom = new DOMDocument();
133 133
             $dom->preserveWhiteSpace = false;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
     * @param bool $formatSource
149 149
     * @return string
150 150
     */
151
-    public static function html(string $html, bool $formatSource=false) : string
151
+    public static function html(string $html, bool $formatSource = false) : string
152 152
     {
153
-        if($formatSource)
153
+        if ($formatSource)
154 154
         {
155 155
             $dom = new DOMDocument();
156 156
             $dom->preserveWhiteSpace = false;
Please login to merge, or discard this patch.
src/ConvertHelper/TimeConverter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     */
49 49
     private function initUnits() : void
50 50
     {
51
-        if(isset(self::$units))
51
+        if (isset(self::$units))
52 52
         {
53 53
             return;
54 54
         }
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
     public function toString() : string
91 91
     {
92 92
         // specifically handle zero
93
-        if($this->seconds <= 0) 
93
+        if ($this->seconds <= 0) 
94 94
         {
95
-            return '0 ' . t('seconds');
95
+            return '0 '.t('seconds');
96 96
         }
97 97
         
98
-        if($this->seconds < 1) 
98
+        if ($this->seconds < 1) 
99 99
         {
100 100
             return t('less than a second');
101 101
         }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 
105 105
         $last = array_pop($tokens);
106 106
         
107
-        if(empty($tokens)) 
107
+        if (empty($tokens)) 
108 108
         {
109 109
             return $last;
110 110
         }
111 111
         
112
-        return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last;
112
+        return implode(', ', $tokens).' '.t('and').' '.$last;
113 113
     }
114 114
     
115 115
    /**
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
         $seconds = $this->seconds;
123 123
         $tokens = array();
124 124
         
125
-        foreach(self::$units as $def)
125
+        foreach (self::$units as $def)
126 126
         {
127 127
             $unitValue = intval($seconds / $def['value']);
128 128
             
129
-            if($unitValue <= 0)
129
+            if ($unitValue <= 0)
130 130
             {
131 131
                 continue;
132 132
             }
133 133
             
134
-            $item = strval($unitValue) . ' ';
134
+            $item = strval($unitValue).' ';
135 135
             
136
-            if(abs($unitValue) > 1)
136
+            if (abs($unitValue) > 1)
137 137
             {
138 138
                 $item .= $def['plural'];
139 139
             }
Please login to merge, or discard this patch.
src/URLInfo/Highlighter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             'fragment'
78 78
         );
79 79
         
80
-        foreach($parts as $part) 
80
+        foreach ($parts as $part) 
81 81
         {
82 82
             $method = 'render_'.$part;
83 83
             $result[] = (string)$this->$method();
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     
89 89
     protected function render_scheme() : string
90 90
     {
91
-        if(!$this->info->hasScheme()) {
91
+        if (!$this->info->hasScheme()) {
92 92
             return '';
93 93
         }
94 94
         
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     
104 104
     protected function render_username() : string
105 105
     {
106
-        if(!$this->info->hasUsername()) {
106
+        if (!$this->info->hasUsername()) {
107 107
             return '';
108 108
         }
109 109
         
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     
120 120
     protected function render_host() : string
121 121
     {
122
-        if(!$this->info->hasHost()) {
122
+        if (!$this->info->hasHost()) {
123 123
             return '';
124 124
         }
125 125
         
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     
132 132
     protected function render_port() : string
133 133
     {
134
-        if(!$this->info->hasPort()) {
134
+        if (!$this->info->hasPort()) {
135 135
             return '';
136 136
         }
137 137
         
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
        
145 145
     protected function render_path() : string
146 146
     {
147
-        if(!$this->info->hasPath()) {
147
+        if (!$this->info->hasPath()) {
148 148
             return '';
149 149
         }
150 150
         
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $previous = $this->info->isParamExclusionEnabled();
171 171
         
172
-        if($previous)
172
+        if ($previous)
173 173
         {
174 174
             $this->info->setParamExclusion(false);
175 175
         }
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $params = $this->resolveParams();
187 187
         
188
-        if(empty($params)) {
188
+        if (empty($params)) {
189 189
             return '';
190 190
         }
191 191
         
192 192
         $tokens = array();
193 193
         $excluded = array();
194 194
         
195
-        if($this->info->isParamExclusionEnabled())
195
+        if ($this->info->isParamExclusionEnabled())
196 196
         {
197 197
             $excluded = $this->info->getExcludedParams();
198 198
         }
199 199
         
200
-        foreach($params as $param => $value)
200
+        foreach ($params as $param => $value)
201 201
         {
202 202
             // If the parameter is numeric, it will automatically
203 203
             // be an integer, so we need the conversion here.
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             
219 219
             $tag = $this->resolveTag($excluded, $param);
220 220
             
221
-            if(!empty($tag))
221
+            if (!empty($tag))
222 222
             {
223 223
                 $tokens[] = sprintf($tag, $parts);
224 224
             }
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
     protected function resolveTag(array $excluded, string $paramName) : string
233 233
     {
234 234
         // regular, non-excluded parameter
235
-        if(!isset($excluded[$paramName]))
235
+        if (!isset($excluded[$paramName]))
236 236
         {
237 237
             return '<span class="link-param">%s</span>';
238 238
         }
239 239
 
240 240
         // highlight excluded parameters is disabled, ignore this parameter
241
-        if(!$this->info->isHighlightExcludeEnabled())
241
+        if (!$this->info->isHighlightExcludeEnabled())
242 242
         {
243 243
             return '';
244 244
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      
255 255
     protected function render_fragment() : string
256 256
     {
257
-        if(!$this->info->hasFragment()) {
257
+        if (!$this->info->hasFragment()) {
258 258
             return '';
259 259
         }
260 260
         
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     {
270 270
         $cssFolder = realpath(__DIR__.'/../../css');
271 271
         
272
-        if($cssFolder === false) {
272
+        if ($cssFolder === false) {
273 273
             throw new BaseException(
274 274
                 'Cannot find package CSS folder.',
275 275
                 null,
Please login to merge, or discard this patch.
src/VariableInfo.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     * @param mixed $value
57 57
     * @param array|null $serialized
58 58
     */
59
-    public function __construct($value, $serialized=null)
59
+    public function __construct($value, $serialized = null)
60 60
     {
61
-        if(is_array($serialized))
61
+        if (is_array($serialized))
62 62
         {
63 63
             $this->parseSerialized($serialized);
64 64
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     */
105 105
     protected function parseSerialized(array $serialized) : void
106 106
     {
107
-        if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
107
+        if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
108 108
         {
109 109
             throw new BaseException(
110 110
                 'Invalid variable info serialized data.',
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
         
127 127
         // Gettype will return a string like "Resource(closed)" when
128 128
         // working with a resource that has already been closed.
129
-        if(strstr($this->type, 'resource'))
129
+        if (strstr($this->type, 'resource'))
130 130
         {
131 131
             $this->type = self::TYPE_RESOURCE;
132 132
         }
133 133
         
134
-        if(is_array($value) && is_callable($value)) {
134
+        if (is_array($value) && is_callable($value)) {
135 135
             $this->type = self::TYPE_CALLABLE;
136 136
         }
137 137
         
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     * @param bool $enable
170 170
     * @return VariableInfo
171 171
     */
172
-    public function enableType(bool $enable=true) : VariableInfo
172
+    public function enableType(bool $enable = true) : VariableInfo
173 173
     {
174 174
         return $this->setOption('prepend-type', $enable);
175 175
     }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $converted = $this->string;
180 180
         
181
-        if($this->getOption('prepend-type') === true && !$this->isNull())
181
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
182 182
         {
183
-            if($this->isString())
183
+            if ($this->isString())
184 184
             {
185 185
                 $converted = '"'.$converted.'"';
186 186
             }
Please login to merge, or discard this patch.
src/CSVHelper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     
171 171
     public function isHeadersPosition($position)
172 172
     {
173
-        if($this->headersPosition === $position) {
173
+        if ($this->headersPosition === $position) {
174 174
             return true;
175 175
         }
176 176
         
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             self::HEADERS_TOP
198 198
         );
199 199
         
200
-        if(!in_array($position, $validPositions)) {
200
+        if (!in_array($position, $validPositions)) {
201 201
             throw new CSVHelper_Exception(
202 202
                 'Invalid headers position',
203 203
                 sprintf(
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     */
254 254
     public function getRow($index)
255 255
     {
256
-        if(isset($this->data[$index])) {
256
+        if (isset($this->data[$index])) {
257 257
             return $this->data[$index];
258 258
         }
259 259
         
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
     public function getColumn($index)
321 321
     {
322 322
         $data = array();
323
-        for($i=0; $i < $this->rowCount; $i++) {
323
+        for ($i = 0; $i < $this->rowCount; $i++) {
324 324
             $value = '';
325
-            if(isset($this->data[$i][$index])) {
325
+            if (isset($this->data[$i][$index])) {
326 326
                 $value = $this->data[$i][$index];
327 327
             }
328 328
             
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     */
340 340
     public function columnExists($index)
341 341
     {
342
-        if($index < $this->columnCount) {
342
+        if ($index < $this->columnCount) {
343 343
             return true;
344 344
         }
345 345
         
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     {
351 351
         $this->reset();
352 352
         
353
-        if(empty(trim($this->csv))) {
353
+        if (empty(trim($this->csv))) {
354 354
             $this->addError('Tried to parse an empty CSV string.');
355 355
             return;
356 356
         }
@@ -362,14 +362,14 @@  discard block
 block discarded – undo
362 362
         
363 363
         $parser = self::createParser();
364 364
 
365
-        if(!$parser->parse($this->csv)) {
365
+        if (!$parser->parse($this->csv)) {
366 366
             $this->addError('The CSV string could not be parsed.');
367 367
             return;
368 368
         }
369 369
 
370 370
         $result = $parser->data;
371 371
 
372
-        switch($this->headersPosition)
372
+        switch ($this->headersPosition)
373 373
         {
374 374
             case self::HEADERS_TOP:
375 375
                 $this->headers = array_shift($result);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             case self::HEADERS_LEFT:
379 379
                 $keep = array();
380 380
                 $total = count($result);
381
-                for($i=0; $i < $total; $i++) {
381
+                for ($i = 0; $i < $total; $i++) {
382 382
                     $row = $result[$i];
383 383
                     $this->headers[] = array_shift($row);
384 384
                     $keep[] = $row;
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
         $this->data = $result;
392 392
         $this->rowCount = count($this->data);
393 393
         
394
-        for($i=0; $i < $this->rowCount; $i++) {
394
+        for ($i = 0; $i < $this->rowCount; $i++) {
395 395
             $amount = count($this->data[$i]);
396
-            if($amount > $this->columnCount) {
396
+            if ($amount > $this->columnCount) {
397 397
                 $this->columnCount = $amount;
398 398
             }
399 399
         }
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
             ',,' => ','
438 438
         );
439 439
         
440
-        foreach($search as $char => $separator) {
441
-            if(strstr($this->csv, $char)) {
440
+        foreach ($search as $char => $separator) {
441
+            if (strstr($this->csv, $char)) {
442 442
                 return $separator;
443 443
             }
444 444
         }
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
      * @param string $delimiter
453 453
      * @return Csv
454 454
      */
455
-    public static function createParser(string $delimiter=self::DELIMITER_AUTO) : Csv
455
+    public static function createParser(string $delimiter = self::DELIMITER_AUTO) : Csv
456 456
     {
457 457
         $csv = new Csv();
458 458
 
459
-        if($delimiter !== self::DELIMITER_AUTO) {
459
+        if ($delimiter !== self::DELIMITER_AUTO) {
460 460
             $csv->delimiter = $delimiter;
461 461
         }
462 462
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         $parser = self::createParser();
483 483
         $result = $parser->parse($path);
484 484
 
485
-        if($result === true) {
485
+        if ($result === true) {
486 486
             return $parser->data;
487 487
         }
488 488
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
         $parser = self::createParser();
513 513
         $result = $parser->parse($string);
514 514
 
515
-        if($result === true) {
515
+        if ($result === true) {
516 516
             return $parser->data;
517 517
         }
518 518
 
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  * @param bool $forceNew
19 19
  * @return NumberInfo
20 20
  */
21
-function parseNumber($value, bool $forceNew=false)
21
+function parseNumber($value, bool $forceNew = false)
22 22
 {
23
-    if($value instanceof NumberInfo && $forceNew !== true) {
23
+    if ($value instanceof NumberInfo && $forceNew !== true) {
24 24
         return $value;
25 25
     }
26 26
     
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     $args = func_get_args();
102 102
     
103 103
     // is the localization package installed?
104
-    if(function_exists('\AppLocalize\t'))
104
+    if (function_exists('\AppLocalize\t'))
105 105
     {
106 106
         return call_user_func_array('\AppLocalize\t', $args);
107 107
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function requireCURL() : void
121 121
 {
122
-    if(function_exists('curl_init')) {
122
+    if (function_exists('curl_init')) {
123 123
         return;
124 124
     }
125 125
     
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  * @param bool $initial The initial boolean value to use.
137 137
  * @return Value_Bool
138 138
  */
139
-function valBool(bool $initial=false) : Value_Bool
139
+function valBool(bool $initial = false) : Value_Bool
140 140
 {
141 141
     return new Value_Bool($initial);
142 142
 }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
  * @param bool $initial
150 150
  * @return Value_Bool_True
151 151
  */
152
-function valBoolTrue(bool $initial=false) : Value_Bool_True
152
+function valBoolTrue(bool $initial = false) : Value_Bool_True
153 153
 {
154 154
     return new Value_Bool_True($initial);
155 155
 }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  * @param bool $initial
163 163
  * @return Value_Bool_False
164 164
  */
165
-function valBoolFalse(bool $initial=true) : Value_Bool_False
165
+function valBoolFalse(bool $initial = true) : Value_Bool_False
166 166
 {
167 167
     return new Value_Bool_False($initial);
168 168
 }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
  */
185 185
 function init()
186 186
 {
187
-    if(!class_exists('\AppLocalize\Localization')) {
187
+    if (!class_exists('\AppLocalize\Localization')) {
188 188
         return;
189 189
     }
190 190
     
Please login to merge, or discard this patch.
localization/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     $autoload = $root.'/vendor/autoload.php';
16 16
     
17 17
     // we need the autoloader to be present
18
-    if($autoload === false) 
18
+    if ($autoload === false) 
19 19
     {
20 20
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
21 21
     }
Please login to merge, or discard this patch.
src/FileHelper.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         
85 85
         $contents = file_get_contents($file);
86 86
         
87
-        if($contents === false) 
87
+        if ($contents === false) 
88 88
         {
89 89
             throw new FileHelper_Exception(
90 90
                 'Cannot load serialized content from file.',
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         
99 99
         $result = @unserialize($contents);
100 100
         
101
-        if($result !== false) {
101
+        if ($result !== false) {
102 102
             return $result;
103 103
         }
104 104
         
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     
115 115
     public static function deleteTree($rootFolder)
116 116
     {
117
-        if(!file_exists($rootFolder)) {
117
+        if (!file_exists($rootFolder)) {
118 118
             return true;
119 119
         }
120 120
         
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     */
156 156
     public static function createFolder($path)
157 157
     {
158
-        if(is_dir($path) || mkdir($path, 0777, true)) {
158
+        if (is_dir($path) || mkdir($path, 0777, true)) {
159 159
             return;
160 160
         }
161 161
         
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 
191 191
             if ($item->isDir()) 
192 192
             {
193
-                FileHelper::copyTree($itemPath, $target . '/' . $baseName);
193
+                FileHelper::copyTree($itemPath, $target.'/'.$baseName);
194 194
             } 
195
-            else if($item->isFile()) 
195
+            else if ($item->isFile()) 
196 196
             {
197
-                self::copyFile($itemPath, $target . '/' . $baseName);
197
+                self::copyFile($itemPath, $target.'/'.$baseName);
198 198
             }
199 199
         }
200 200
     }
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
         
223 223
         $targetFolder = dirname($targetPath);
224 224
         
225
-        if(!file_exists($targetFolder))
225
+        if (!file_exists($targetFolder))
226 226
         {
227 227
             self::createFolder($targetFolder);
228 228
         }
229
-        else if(!is_writable($targetFolder)) 
229
+        else if (!is_writable($targetFolder)) 
230 230
         {
231 231
             throw new FileHelper_Exception(
232 232
                 sprintf('Target folder [%s] is not writable.', basename($targetFolder)),
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             );
239 239
         }
240 240
         
241
-        if(copy($sourcePath, $targetPath)) {
241
+        if (copy($sourcePath, $targetPath)) {
242 242
             return;
243 243
         }
244 244
         
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
     */
266 266
     public static function deleteFile(string $filePath) : void
267 267
     {
268
-        if(!file_exists($filePath)) {
268
+        if (!file_exists($filePath)) {
269 269
             return;
270 270
         }
271 271
         
272
-        if(unlink($filePath)) {
272
+        if (unlink($filePath)) {
273 273
             return;
274 274
         }
275 275
         
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
     * @return Csv
294 294
      * @see CSVHelper::createParser()
295 295
     */
296
-    public static function createCSVParser(string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : Csv
296
+    public static function createCSVParser(string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : Csv
297 297
     {
298
-        if($delimiter==='') { $delimiter = ';'; }
299
-        if($enclosure==='') { $enclosure = '"'; }
298
+        if ($delimiter === '') { $delimiter = ';'; }
299
+        if ($enclosure === '') { $enclosure = '"'; }
300 300
 
301 301
         $parser = CSVHelper::createParser($delimiter);
302 302
         $parser->enclosure = $enclosure;
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
     * @see parseCSVFile()
321 321
     * @see FileHelper::ERROR_PARSING_CSV
322 322
     */
323
-    public static function parseCSVString(string $csv, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : array
323
+    public static function parseCSVString(string $csv, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : array
324 324
     {
325 325
         $parser = self::createCSVParser($delimiter, $enclosure, '\\', $heading);
326 326
 
327
-        if($parser->parse($csv))
327
+        if ($parser->parse($csv))
328 328
         {
329 329
             return $parser->data;
330 330
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
353 353
      * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
354 354
      */
355
-    public static function parseCSVFile(string $filePath, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading=false) : array
355
+    public static function parseCSVFile(string $filePath, string $delimiter = ';', string $enclosure = '"', string $escape = '\\', bool $heading = false) : array
356 356
     {
357 357
         $content = self::readContents($filePath);
358 358
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     public static function detectMimeType(string $fileName) : ?string
370 370
     {
371 371
         $ext = self::getExtension($fileName);
372
-        if(empty($ext)) {
372
+        if (empty($ext)) {
373 373
             return null;
374 374
         }
375 375
 
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
      * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
391 391
      * @see FileHelper::ERROR_UNKNOWN_FILE_MIME_TYPE
392 392
      */
393
-    public static function sendFile(string $filePath, $fileName = null, bool $asAttachment=true)
393
+    public static function sendFile(string $filePath, $fileName = null, bool $asAttachment = true)
394 394
     {
395 395
         self::requireFileExists($filePath);
396 396
         
397
-        if(empty($fileName)) {
397
+        if (empty($fileName)) {
398 398
             $fileName = basename($filePath);
399 399
         }
400 400
 
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
         
413 413
         header("Cache-Control: public", true);
414 414
         header("Content-Description: File Transfer", true);
415
-        header("Content-Type: " . $mime, true);
415
+        header("Content-Type: ".$mime, true);
416 416
 
417 417
         $disposition = 'inline';
418
-        if($asAttachment) {
418
+        if ($asAttachment) {
419 419
             $disposition = 'attachment';
420 420
         }
421 421
         
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
         requireCURL();
444 444
         
445 445
         $ch = curl_init();
446
-        if(!is_resource($ch)) 
446
+        if (!is_resource($ch)) 
447 447
         {
448 448
             throw new FileHelper_Exception(
449 449
                 'Could not initialize a new cURL instance.',
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
         
465 465
         $output = curl_exec($ch);
466 466
 
467
-        if($output === false) {
467
+        if ($output === false) {
468 468
             throw new FileHelper_Exception(
469 469
                 'Unable to open URL',
470 470
                 sprintf(
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
         curl_close($ch);
480 480
 
481
-        if(is_string($output)) 
481
+        if (is_string($output)) 
482 482
         {
483 483
             return $output;
484 484
         }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     */
501 501
     public static function isPHPFile($pathOrDirIterator)
502 502
     {
503
-    	if(self::getExtension($pathOrDirIterator) == 'php') {
503
+    	if (self::getExtension($pathOrDirIterator) == 'php') {
504 504
     		return true;
505 505
     	}
506 506
     	
@@ -517,14 +517,14 @@  discard block
 block discarded – undo
517 517
     */
518 518
     public static function getExtension($pathOrDirIterator, bool $lowercase = true) : string
519 519
     {
520
-        if($pathOrDirIterator instanceof \DirectoryIterator) {
520
+        if ($pathOrDirIterator instanceof \DirectoryIterator) {
521 521
             $filename = $pathOrDirIterator->getFilename();
522 522
         } else {
523 523
             $filename = basename($pathOrDirIterator);
524 524
         }
525 525
          
526 526
         $ext = pathinfo($filename, PATHINFO_EXTENSION);
527
-        if($lowercase) {
527
+        if ($lowercase) {
528 528
         	$ext = mb_strtolower($ext);
529 529
         }
530 530
         
@@ -546,13 +546,13 @@  discard block
 block discarded – undo
546 546
     public static function getFilename($pathOrDirIterator, $extension = true)
547 547
     {
548 548
         $path = $pathOrDirIterator;
549
-    	if($pathOrDirIterator instanceof \DirectoryIterator) {
549
+    	if ($pathOrDirIterator instanceof \DirectoryIterator) {
550 550
     		$path = $pathOrDirIterator->getFilename();
551 551
     	}
552 552
     	
553 553
     	$path = self::normalizePath($path);
554 554
     	
555
-    	if(!$extension) {
555
+    	if (!$extension) {
556 556
     	    return pathinfo($path, PATHINFO_FILENAME);
557 557
     	}
558 558
     	
@@ -570,12 +570,12 @@  discard block
 block discarded – undo
570 570
     * @see FileHelper::ERROR_CANNOT_FIND_JSON_FILE
571 571
     * @see FileHelper::ERROR_CANNOT_DECODE_JSON_FILE
572 572
     */ 
573
-    public static function parseJSONFile(string $file, $targetEncoding=null, $sourceEncoding=null)
573
+    public static function parseJSONFile(string $file, $targetEncoding = null, $sourceEncoding = null)
574 574
     {
575 575
         self::requireFileExists($file, self::ERROR_CANNOT_FIND_JSON_FILE);
576 576
         
577 577
         $content = file_get_contents($file);
578
-        if(!$content) {
578
+        if (!$content) {
579 579
             throw new FileHelper_Exception(
580 580
                 'Cannot get file contents',
581 581
                 sprintf(
@@ -586,12 +586,12 @@  discard block
 block discarded – undo
586 586
             );
587 587
         }
588 588
         
589
-        if(isset($targetEncoding)) {
589
+        if (isset($targetEncoding)) {
590 590
             $content = mb_convert_encoding($content, $targetEncoding, $sourceEncoding);
591 591
         }
592 592
         
593 593
         $json = json_decode($content, true);
594
-        if($json === false || $json === NULL) {
594
+        if ($json === false || $json === NULL) {
595 595
             throw new FileHelper_Exception(
596 596
                 'Cannot decode json data',
597 597
                 sprintf(
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
         
632 632
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
633 633
         
634
-        while(strstr($name, '  ')) {
634
+        while (strstr($name, '  ')) {
635 635
             $name = str_replace('  ', ' ', $name);
636 636
         }
637 637
 
638 638
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
639 639
         
640
-        while(strstr($name, '..')) {
640
+        while (strstr($name, '..')) {
641 641
             $name = str_replace('..', '.', $name);
642 642
         }
643 643
         
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
     * @return array An indexed array with files.
670 670
     * @see FileHelper::createFileFinder()
671 671
     */
672
-    public static function findHTMLFiles(string $targetFolder, array $options=array()) : array
672
+    public static function findHTMLFiles(string $targetFolder, array $options = array()) : array
673 673
     {
674 674
         return self::findFiles($targetFolder, array('html'), $options);
675 675
     }
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
     * @return array An indexed array of PHP files.
687 687
     * @see FileHelper::createFileFinder()
688 688
     */
689
-    public static function findPHPFiles(string $targetFolder, array $options=array()) : array
689
+    public static function findPHPFiles(string $targetFolder, array $options = array()) : array
690 690
     {
691 691
         return self::findFiles($targetFolder, array('php'), $options);
692 692
     }
@@ -706,22 +706,22 @@  discard block
 block discarded – undo
706 706
     * @return array
707 707
     * @see FileHelper::createFileFinder()
708 708
     */
709
-    public static function findFiles(string $targetFolder, array $extensions=array(), array $options=array(), array $files=array()) : array
709
+    public static function findFiles(string $targetFolder, array $extensions = array(), array $options = array(), array $files = array()) : array
710 710
     {
711 711
         $finder = self::createFileFinder($targetFolder);
712 712
 
713 713
         $finder->setPathmodeStrip();
714 714
         
715
-        if(isset($options['relative-path']) && $options['relative-path'] === true) 
715
+        if (isset($options['relative-path']) && $options['relative-path'] === true) 
716 716
         {
717 717
             $finder->setPathmodeRelative();
718 718
         } 
719
-        else if(isset($options['absolute-path']) && $options['absolute-path'] === true)
719
+        else if (isset($options['absolute-path']) && $options['absolute-path'] === true)
720 720
         {
721 721
             $finder->setPathmodeAbsolute();
722 722
         }
723 723
         
724
-        if(isset($options['strip-extension'])) 
724
+        if (isset($options['strip-extension'])) 
725 725
         {
726 726
             $finder->stripExtensions();
727 727
         }
@@ -739,12 +739,12 @@  discard block
 block discarded – undo
739 739
     * @param bool $keepPath Whether to keep the path component, if any. Default PHP pathinfo behavior is not to.
740 740
     * @return string
741 741
     */
742
-    public static function removeExtension(string $filename, bool $keepPath=false) : string
742
+    public static function removeExtension(string $filename, bool $keepPath = false) : string
743 743
     {
744 744
         // normalize paths to allow windows style slashes even on nix servers
745 745
         $filename = self::normalizePath($filename);
746 746
         
747
-        if(!$keepPath) 
747
+        if (!$keepPath) 
748 748
         {
749 749
             return pathinfo($filename, PATHINFO_FILENAME);
750 750
         }
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
     public static function detectUTFBom(string $filename) : ?string
778 778
     {
779 779
         $fp = fopen($filename, 'r');
780
-        if($fp === false) 
780
+        if ($fp === false) 
781 781
         {
782 782
             throw new FileHelper_Exception(
783 783
                 'Cannot open file for reading',
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
 
793 793
         $boms = self::getUTFBOMs();
794 794
         
795
-        foreach($boms as $bom => $value) 
795
+        foreach ($boms as $bom => $value) 
796 796
         {
797 797
             $length = mb_strlen($value);
798
-            if(mb_substr($text, 0, $length) == $value) {
798
+            if (mb_substr($text, 0, $length) == $value) {
799 799
                 return $bom;
800 800
             }
801 801
         }
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
     */
815 815
     public static function getUTFBOMs()
816 816
     {
817
-        if(!isset(self::$utfBoms)) {
817
+        if (!isset(self::$utfBoms)) {
818 818
             self::$utfBoms = array(
819
-                'UTF32-BE' => chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF),
820
-                'UTF32-LE' => chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00),
821
-                'UTF16-BE' => chr(0xFE) . chr(0xFF),
822
-                'UTF16-LE' => chr(0xFF) . chr(0xFE),
823
-                'UTF8' => chr(0xEF) . chr(0xBB) . chr(0xBF)
819
+                'UTF32-BE' => chr(0x00).chr(0x00).chr(0xFE).chr(0xFF),
820
+                'UTF32-LE' => chr(0xFF).chr(0xFE).chr(0x00).chr(0x00),
821
+                'UTF16-BE' => chr(0xFE).chr(0xFF),
822
+                'UTF16-LE' => chr(0xFF).chr(0xFE),
823
+                'UTF8' => chr(0xEF).chr(0xBB).chr(0xBF)
824 824
             );
825 825
         }
826 826
         
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
         $encodings = self::getKnownUnicodeEncodings();
842 842
 
843 843
         $keep = array();
844
-        foreach($encodings as $string) 
844
+        foreach ($encodings as $string) 
845 845
         {
846 846
             $withHyphen = str_replace('UTF', 'UTF-', $string);
847 847
             
@@ -888,16 +888,16 @@  discard block
 block discarded – undo
888 888
     * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
889 889
     * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
890 890
     */
891
-    public static function saveAsJSON($data, string $file, bool $pretty=false)
891
+    public static function saveAsJSON($data, string $file, bool $pretty = false)
892 892
     {
893 893
         $options = null;
894
-        if($pretty) {
894
+        if ($pretty) {
895 895
             $options = JSON_PRETTY_PRINT;
896 896
         }
897 897
         
898 898
         $json = json_encode($data, $options);
899 899
         
900
-        if($json===false) 
900
+        if ($json === false) 
901 901
         {
902 902
             $errorCode = json_last_error();
903 903
             
@@ -923,14 +923,14 @@  discard block
 block discarded – undo
923 923
     * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
924 924
     * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
925 925
     */
926
-    public static function saveFile(string $filePath, string $content='') : void
926
+    public static function saveFile(string $filePath, string $content = '') : void
927 927
     {
928 928
         $filePath = self::normalizePath($filePath);
929 929
         
930 930
         // target file already exists
931
-        if(file_exists($filePath))
931
+        if (file_exists($filePath))
932 932
         {
933
-            if(!is_writable($filePath))
933
+            if (!is_writable($filePath))
934 934
             {
935 935
                 throw new FileHelper_Exception(
936 936
                     sprintf('Cannot save file: target file [%s] exists, but is not writable.', basename($filePath)),
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
             // create the folder as needed
951 951
             self::createFolder($targetFolder);
952 952
             
953
-            if(!is_writable($targetFolder)) 
953
+            if (!is_writable($targetFolder)) 
954 954
             {
955 955
                 throw new FileHelper_Exception(
956 956
                     sprintf('Cannot save file: target folder [%s] is not writable.', basename($targetFolder)),
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
             }
964 964
         }
965 965
         
966
-        if(is_dir($filePath))
966
+        if (is_dir($filePath))
967 967
         {
968 968
             throw new FileHelper_Exception(
969 969
                 sprintf('Cannot save file: the target [%s] is a directory.', basename($filePath)),
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
             );
976 976
         }
977 977
         
978
-        if(file_put_contents($filePath, $content) !== false) {
978
+        if (file_put_contents($filePath, $content) !== false) {
979 979
             return;
980 980
         }
981 981
         
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
     {
1015 1015
         static $checked = array();
1016 1016
         
1017
-        if(isset($checked[$command])) {
1017
+        if (isset($checked[$command])) {
1018 1018
             return $checked[$command];
1019 1019
         }
1020 1020
         
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
         
1028 1028
         $os = strtolower(PHP_OS_FAMILY);
1029 1029
         
1030
-        if(!isset($osCommands[$os])) 
1030
+        if (!isset($osCommands[$os])) 
1031 1031
         {
1032 1032
             throw new FileHelper_Exception(
1033 1033
                 'Unsupported OS for CLI commands',
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
             $pipes
1054 1054
         );
1055 1055
         
1056
-        if($process === false) {
1056
+        if ($process === false) {
1057 1057
             $checked[$command] = false;
1058 1058
             return false;
1059 1059
         }
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
     */
1085 1085
     public static function checkPHPFileSyntax($path)
1086 1086
     {
1087
-        if(!self::canMakePHPCalls()) {
1087
+        if (!self::canMakePHPCalls()) {
1088 1088
             return true;
1089 1089
         }
1090 1090
         
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
         // when the validation is successful, the first entry
1096 1096
         // in the array contains the success message. When it
1097 1097
         // is invalid, the first entry is always empty.
1098
-        if(!empty($output[0])) {
1098
+        if (!empty($output[0])) {
1099 1099
             return true;
1100 1100
         }
1101 1101
         
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
     public static function getModifiedDate($path)
1117 1117
     {
1118 1118
         $time = filemtime($path);
1119
-        if($time !== false) {
1119
+        if ($time !== false) {
1120 1120
             $date = new \DateTime();
1121 1121
             $date->setTimestamp($time);
1122 1122
             return $date;
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
     */
1146 1146
     public static function getSubfolders($targetFolder, $options = array())
1147 1147
     {
1148
-        if(!is_dir($targetFolder)) 
1148
+        if (!is_dir($targetFolder)) 
1149 1149
         {
1150 1150
             throw new FileHelper_Exception(
1151 1151
                 'Target folder does not exist',
@@ -1169,29 +1169,29 @@  discard block
 block discarded – undo
1169 1169
         
1170 1170
         $d = new \DirectoryIterator($targetFolder);
1171 1171
         
1172
-        foreach($d as $item) 
1172
+        foreach ($d as $item) 
1173 1173
         {
1174
-            if($item->isDir() && !$item->isDot()) 
1174
+            if ($item->isDir() && !$item->isDot()) 
1175 1175
             {
1176 1176
                 $name = $item->getFilename();
1177 1177
                 
1178
-                if(!$options['absolute-path']) {
1178
+                if (!$options['absolute-path']) {
1179 1179
                     $result[] = $name;
1180 1180
                 } else {
1181 1181
                     $result[] = $targetFolder.'/'.$name;
1182 1182
                 }
1183 1183
                 
1184
-                if(!$options['recursive']) 
1184
+                if (!$options['recursive']) 
1185 1185
                 {
1186 1186
                     continue;
1187 1187
                 }
1188 1188
                 
1189 1189
                 $subs = self::getSubfolders($targetFolder.'/'.$name, $options);
1190
-                foreach($subs as $sub) 
1190
+                foreach ($subs as $sub) 
1191 1191
                 {
1192 1192
                     $relative = $name.'/'.$sub;
1193 1193
                     
1194
-                    if(!$options['absolute-path']) {
1194
+                    if (!$options['absolute-path']) {
1195 1195
                         $result[] = $relative;
1196 1196
                     } else {
1197 1197
                         $result[] = $targetFolder.'/'.$relative;
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
         $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
1242 1242
         $size = floatval(preg_replace('/[^0-9\.]/', '', $size)); // Remove the non-numeric characters from the size.
1243 1243
         
1244
-        if($unit) 
1244
+        if ($unit) 
1245 1245
         {
1246 1246
             // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
1247 1247
             return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
     * @param int $depth The folder depth to reduce the path to
1261 1261
     * @return string
1262 1262
     */
1263
-    public static function relativizePathByDepth(string $path, int $depth=2) : string
1263
+    public static function relativizePathByDepth(string $path, int $depth = 2) : string
1264 1264
     {
1265 1265
         $path = self::normalizePath($path);
1266 1266
         
@@ -1268,17 +1268,17 @@  discard block
 block discarded – undo
1268 1268
         $tokens = array_filter($tokens); // remove empty entries (trailing slash for example)
1269 1269
         $tokens = array_values($tokens); // re-index keys
1270 1270
         
1271
-        if(empty($tokens)) {
1271
+        if (empty($tokens)) {
1272 1272
             return '';
1273 1273
         }
1274 1274
         
1275 1275
         // remove the drive if present
1276
-        if(strstr($tokens[0], ':')) {
1276
+        if (strstr($tokens[0], ':')) {
1277 1277
             array_shift($tokens);
1278 1278
         }
1279 1279
         
1280 1280
         // path was only the drive
1281
-        if(count($tokens) == 0) {
1281
+        if (count($tokens) == 0) {
1282 1282
             return '';
1283 1283
         }
1284 1284
 
@@ -1287,8 +1287,8 @@  discard block
 block discarded – undo
1287 1287
         
1288 1288
         // reduce the path to the specified depth
1289 1289
         $length = count($tokens);
1290
-        if($length > $depth) {
1291
-            $tokens = array_slice($tokens, $length-$depth);
1290
+        if ($length > $depth) {
1291
+            $tokens = array_slice($tokens, $length - $depth);
1292 1292
         }
1293 1293
 
1294 1294
         // append the last element again
@@ -1336,14 +1336,14 @@  discard block
 block discarded – undo
1336 1336
     * 
1337 1337
     * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
1338 1338
     */
1339
-    public static function requireFileExists(string $path, ?int $errorCode=null) : string
1339
+    public static function requireFileExists(string $path, ?int $errorCode = null) : string
1340 1340
     {
1341 1341
         $result = realpath($path);
1342
-        if($result !== false) {
1342
+        if ($result !== false) {
1343 1343
             return $result;
1344 1344
         }
1345 1345
         
1346
-        if($errorCode === null) {
1346
+        if ($errorCode === null) {
1347 1347
             $errorCode = self::ERROR_FILE_DOES_NOT_EXIST;
1348 1348
         }
1349 1349
         
@@ -1354,15 +1354,15 @@  discard block
 block discarded – undo
1354 1354
         );
1355 1355
     }
1356 1356
 
1357
-    public static function requireFileReadable(string $path, ?int $errorCode=null) : string
1357
+    public static function requireFileReadable(string $path, ?int $errorCode = null) : string
1358 1358
     {
1359 1359
         $path = self::requireFileExists($path, $errorCode);
1360 1360
 
1361
-        if(is_readable($path)) {
1361
+        if (is_readable($path)) {
1362 1362
             return $path;
1363 1363
         }
1364 1364
 
1365
-        if($errorCode === null) {
1365
+        if ($errorCode === null) {
1366 1366
             $errorCode = self::ERROR_FILE_NOT_READABLE;
1367 1367
         }
1368 1368
 
@@ -1391,15 +1391,15 @@  discard block
 block discarded – undo
1391 1391
         
1392 1392
         $file = new \SplFileObject($path);
1393 1393
         
1394
-        if($file->eof()) {
1394
+        if ($file->eof()) {
1395 1395
             return '';
1396 1396
         }
1397 1397
         
1398
-        $targetLine = $lineNumber-1;
1398
+        $targetLine = $lineNumber - 1;
1399 1399
         
1400 1400
         $file->seek($targetLine);
1401 1401
         
1402
-        if($file->key() !== $targetLine) {
1402
+        if ($file->key() !== $targetLine) {
1403 1403
              return null;
1404 1404
         }
1405 1405
         
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
         $number = $spl->key();
1426 1426
         
1427 1427
         // if seeking to the end the cursor is still at 0, there are no lines. 
1428
-        if($number === 0) 
1428
+        if ($number === 0) 
1429 1429
         {
1430 1430
             // since it's a very small file, to get reliable results,
1431 1431
             // we read its contents and use that to determine what
@@ -1433,13 +1433,13 @@  discard block
 block discarded – undo
1433 1433
             // that this is not pactical to solve with the SplFileObject.
1434 1434
             $content = file_get_contents($path);
1435 1435
             
1436
-            if(empty($content)) {
1436
+            if (empty($content)) {
1437 1437
                 return 0;
1438 1438
             }
1439 1439
         }
1440 1440
         
1441 1441
         // return the line number we were able to reach + 1 (key is zero-based)
1442
-        return $number+1;
1442
+        return $number + 1;
1443 1443
     }
1444 1444
     
1445 1445
    /**
@@ -1486,13 +1486,13 @@  discard block
 block discarded – undo
1486 1486
     * @see FileHelper::ERROR_CANNOT_OPEN_FILE_TO_READ_LINES
1487 1487
     * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
1488 1488
     */
1489
-    public static function readLines(string $filePath, int $amount=0) : array
1489
+    public static function readLines(string $filePath, int $amount = 0) : array
1490 1490
     {
1491 1491
         self::requireFileExists($filePath);
1492 1492
         
1493 1493
         $fn = fopen($filePath, "r");
1494 1494
         
1495
-        if($fn === false) 
1495
+        if ($fn === false) 
1496 1496
         {
1497 1497
             throw new FileHelper_Exception(
1498 1498
                 'Could not open file for reading.',
@@ -1508,19 +1508,19 @@  discard block
 block discarded – undo
1508 1508
         $counter = 0;
1509 1509
         $first = true;
1510 1510
         
1511
-        while(!feof($fn)) 
1511
+        while (!feof($fn)) 
1512 1512
         {
1513 1513
             $counter++;
1514 1514
             
1515 1515
             $line = fgets($fn);
1516 1516
             
1517 1517
             // can happen with zero length files
1518
-            if($line === false) {
1518
+            if ($line === false) {
1519 1519
                 continue;
1520 1520
             }
1521 1521
             
1522 1522
             // the first line may contain a unicode BOM marker.
1523
-            if($first) 
1523
+            if ($first) 
1524 1524
             {
1525 1525
                 $line = ConvertHelper::stripUTFBom($line);
1526 1526
                 $first = false;
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
             
1529 1529
             $result[] = $line;
1530 1530
             
1531
-            if($amount > 0 && $counter == $amount) {
1531
+            if ($amount > 0 && $counter == $amount) {
1532 1532
                 break;
1533 1533
             }
1534 1534
         }
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
         
1555 1555
         $result = file_get_contents($filePath);
1556 1556
         
1557
-        if($result !== false) {
1557
+        if ($result !== false) {
1558 1558
             return $result;
1559 1559
         }
1560 1560
         
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
     {
1585 1585
         $actual = realpath($path);
1586 1586
         
1587
-        if($actual === false) 
1587
+        if ($actual === false) 
1588 1588
         {
1589 1589
             throw new FileHelper_Exception(
1590 1590
                 'Folder does not exist',
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
             );
1597 1597
         }
1598 1598
         
1599
-        if(is_dir($path)) 
1599
+        if (is_dir($path)) 
1600 1600
         {
1601 1601
             return self::normalizePath($actual);
1602 1602
         }
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
      * @param string[] $paths
1619 1619
      * @return FileHelper_PathsReducer
1620 1620
      */
1621
-    public static function createPathsReducer(array $paths=array()) : FileHelper_PathsReducer
1621
+    public static function createPathsReducer(array $paths = array()) : FileHelper_PathsReducer
1622 1622
     {
1623 1623
         return new FileHelper_PathsReducer();
1624 1624
     }
Please login to merge, or discard this patch.
src/URLInfo/Filter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
         // In the case of tel URLs, we convert the syntax to use double
31 31
         // slashes to make them parsable.
32
-        if(strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) {
32
+        if (strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) {
33 33
             $url = str_replace('tel:', 'tel://', $url);
34 34
         }
35 35
 
Please login to merge, or discard this patch.