From e2603cb1c20a07be3de7e5ed28347d780dca9829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ewilan=20Rivi=C3=A8re?= Date: Mon, 28 Aug 2023 12:56:39 +0200 Subject: [PATCH] 2.0.02 - Add `skipAllowed` param to `Archive::class` --- composer.json | 2 +- src/Archive.php | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index adeb843..4279cd5 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "kiwilan/php-archive", - "version": "2.0.01", + "version": "2.0.02", "description": "PHP package to handle archives (.zip, .rar, .tar, .7z) or .pdf with hybrid solution (native/p7zip), designed to works with eBooks (.epub, .cbz, .cbr, .cb7, .cbt).", "keywords": [ "php", diff --git a/src/Archive.php b/src/Archive.php index 5ea3a2d..4385592 100755 --- a/src/Archive.php +++ b/src/Archive.php @@ -19,6 +19,9 @@ protected function __construct( ) { } + /** + * Read an archive from the path. + */ public static function read(string $path): BaseArchive { if (! file_exists($path)) { @@ -42,11 +45,17 @@ public static function read(string $path): BaseArchive return $archive::read($self->path); } - public static function make(string $path): ArchiveZipCreate + /** + * Create an archive from path, allowing extensions are `zip`, `epub`, `cbz`. + * + * @param string $path Path to the archive + * @param bool $skipAllowed Skip allowed extensions check + * + * @throws \Exception + */ + public static function make(string $path, bool $skipAllowed = false): ArchiveZipCreate { - $archive = ArchiveZipCreate::make($path); - - return $archive; + return ArchiveZipCreate::make($path, $skipAllowed); } /**