Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.02 #32

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
17 changes: 13 additions & 4 deletions src/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ protected function __construct(
) {
}

/**
* Read an archive from the path.
*/
public static function read(string $path): BaseArchive
{
if (! file_exists($path)) {
Expand All @@ -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);
}

/**
Expand Down