@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public static function detectMimeType($fileName) : ?string |
208 | 208 | { |
209 | 209 | $ext = self::getExtension($fileName); |
210 | - if(empty($ext)) { |
|
210 | + if (empty($ext)) { |
|
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST |
252 | 252 | * @see FileHelper::ERROR_UNKNOWN_FILE_MIME_TYPE |
253 | 253 | */ |
254 | - public static function sendFile($filePath, ?string $fileName = null, bool $asAttachment=true) : void |
|
254 | + public static function sendFile($filePath, ?string $fileName = null, bool $asAttachment = true) : void |
|
255 | 255 | { |
256 | 256 | self::getFileInfo($filePath)->getDownloader()->send($fileName, $asAttachment); |
257 | 257 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @throws FileHelper_Exception |
269 | 269 | * @see FileHelper::ERROR_CANNOT_OPEN_URL |
270 | 270 | */ |
271 | - public static function downloadFile(string $url, int $timeout=0, bool $SSLEnabled=false) : string |
|
271 | + public static function downloadFile(string $url, int $timeout = 0, bool $SSLEnabled = false) : string |
|
272 | 272 | { |
273 | 273 | return FileDownloader::factory($url) |
274 | 274 | ->setTimeout($timeout) |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | $info = self::getPathInfo($pathOrDirIterator); |
325 | 325 | |
326 | - if($extension === true || $info instanceof FolderInfo) |
|
326 | + if ($extension === true || $info instanceof FolderInfo) |
|
327 | 327 | { |
328 | 328 | return $info->getName(); |
329 | 329 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @see FileHelper::ERROR_CANNOT_FIND_JSON_FILE |
346 | 346 | * @see FileHelper::ERROR_CANNOT_DECODE_JSON_FILE |
347 | 347 | */ |
348 | - public static function parseJSONFile($file, string $targetEncoding='', $sourceEncoding=null) : array |
|
348 | + public static function parseJSONFile($file, string $targetEncoding = '', $sourceEncoding = null) : array |
|
349 | 349 | { |
350 | 350 | return JSONFile::factory($file) |
351 | 351 | ->setTargetEncoding($targetEncoding) |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @throws FileHelper_Exception |
399 | 399 | * @see FileHelper::createFileFinder() |
400 | 400 | */ |
401 | - public static function findHTMLFiles($targetFolder, array $options=array()) : array |
|
401 | + public static function findHTMLFiles($targetFolder, array $options = array()) : array |
|
402 | 402 | { |
403 | 403 | return self::findFiles($targetFolder, array('html'), $options); |
404 | 404 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @throws FileHelper_Exception |
418 | 418 | * @see FileHelper::createFileFinder() |
419 | 419 | */ |
420 | - public static function findPHPFiles($targetFolder, array $options=array()) : array |
|
420 | + public static function findPHPFiles($targetFolder, array $options = array()) : array |
|
421 | 421 | { |
422 | 422 | return self::findFiles($targetFolder, array('php'), $options); |
423 | 423 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * @see FileHelper::createFileFinder() |
440 | 440 | * @deprecated Use the file finder instead. |
441 | 441 | */ |
442 | - public static function findFiles($targetFolder, array $extensions=array(), array $options=array()) : array |
|
442 | + public static function findFiles($targetFolder, array $extensions = array(), array $options = array()) : array |
|
443 | 443 | { |
444 | 444 | $finder = self::createFileFinder($targetFolder); |
445 | 445 | |
@@ -449,16 +449,16 @@ discard block |
||
449 | 449 | |
450 | 450 | $finder->setPathmodeStrip(); |
451 | 451 | |
452 | - if(isset($options['relative-path']) && $options['relative-path'] === true) |
|
452 | + if (isset($options['relative-path']) && $options['relative-path'] === true) |
|
453 | 453 | { |
454 | 454 | $finder->setPathmodeRelative(); |
455 | 455 | } |
456 | - else if(isset($options['absolute-path']) && $options['absolute-path'] === true) |
|
456 | + else if (isset($options['absolute-path']) && $options['absolute-path'] === true) |
|
457 | 457 | { |
458 | 458 | $finder->setPathmodeAbsolute(); |
459 | 459 | } |
460 | 460 | |
461 | - if(isset($options['strip-extension'])) |
|
461 | + if (isset($options['strip-extension'])) |
|
462 | 462 | { |
463 | 463 | $finder->stripExtensions(); |
464 | 464 | } |
@@ -477,16 +477,16 @@ discard block |
||
477 | 477 | * @return string |
478 | 478 | * @throws FileHelper_Exception |
479 | 479 | */ |
480 | - public static function removeExtension($filename, bool $keepPath=false) : string |
|
480 | + public static function removeExtension($filename, bool $keepPath = false) : string |
|
481 | 481 | { |
482 | 482 | $path = self::getPathInfo($filename); |
483 | 483 | |
484 | - if($path instanceof FileInfo) |
|
484 | + if ($path instanceof FileInfo) |
|
485 | 485 | { |
486 | 486 | return $path->removeExtension($keepPath); |
487 | 487 | } |
488 | 488 | |
489 | - if($keepPath) |
|
489 | + if ($keepPath) |
|
490 | 490 | { |
491 | 491 | return $filename; |
492 | 492 | } |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | public static function createUnicodeHandling() : UnicodeHandling |
503 | 503 | { |
504 | - if(!isset(self::$unicodeHandling)) |
|
504 | + if (!isset(self::$unicodeHandling)) |
|
505 | 505 | { |
506 | 506 | self::$unicodeHandling = new UnicodeHandling(); |
507 | 507 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
536 | 536 | * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
537 | 537 | */ |
538 | - public static function saveAsJSON($data, $file, bool $pretty=false) : JSONFile |
|
538 | + public static function saveAsJSON($data, $file, bool $pretty = false) : JSONFile |
|
539 | 539 | { |
540 | 540 | return JSONFile::factory($file)->putData($data, $pretty); |
541 | 541 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
554 | 554 | * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
555 | 555 | */ |
556 | - public static function saveFile($filePath, string $content='') : FileInfo |
|
556 | + public static function saveFile($filePath, string $content = '') : FileInfo |
|
557 | 557 | { |
558 | 558 | return self::getFileInfo($filePath)->putContents($content); |
559 | 559 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @param int $depth The folder depth to reduce the path to |
666 | 666 | * @return string |
667 | 667 | */ |
668 | - public static function relativizePathByDepth(string $path, int $depth=2) : string |
|
668 | + public static function relativizePathByDepth(string $path, int $depth = 2) : string |
|
669 | 669 | { |
670 | 670 | return PathRelativizer::relativizeByDepth($path, $depth); |
671 | 671 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST |
705 | 705 | * @see FileHelper::ERROR_REAL_PATH_NOT_FOUND |
706 | 706 | */ |
707 | - public static function requireFileExists($path, ?int $errorCode=null) : string |
|
707 | + public static function requireFileExists($path, ?int $errorCode = null) : string |
|
708 | 708 | { |
709 | 709 | return self::getPathInfo($path) |
710 | 710 | ->requireIsFile() |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @return string |
719 | 719 | * @throws FileHelper_Exception |
720 | 720 | */ |
721 | - public static function requireFileReadable($path, ?int $errorCode=null) : string |
|
721 | + public static function requireFileReadable($path, ?int $errorCode = null) : string |
|
722 | 722 | { |
723 | 723 | return self::getPathInfo($path) |
724 | 724 | ->requireIsFile() |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST |
797 | 797 | * @see FileHelper::ERROR_CANNOT_OPEN_FILE_TO_READ_LINES |
798 | 798 | */ |
799 | - public static function readLines($filePath, int $amount=0) : array |
|
799 | + public static function readLines($filePath, int $amount = 0) : array |
|
800 | 800 | { |
801 | 801 | return self::getFileInfo($filePath) |
802 | 802 | ->getLineReader() |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * |
847 | 847 | * @throws FileHelper_Exception |
848 | 848 | */ |
849 | - public static function createPathsReducer(array $paths=array()) : PathsReducer |
|
849 | + public static function createPathsReducer(array $paths = array()) : PathsReducer |
|
850 | 850 | { |
851 | 851 | return new PathsReducer($paths); |
852 | 852 | } |