diff --git a/docs/API.md b/docs/API.md index 78b9f5a..3150e7e 100644 --- a/docs/API.md +++ b/docs/API.md @@ -21,7 +21,7 @@ All methods are static. |-----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `Formats::detectArchiveFormat` | `string $archiveFileName, bool $contentCheck = true` | `?string` | Detects a format of given archive by file name and content (when `$contentCheck = true`). Returns one of `Formats` constant or `null` if format is not detected. | | `Formats::getFormatMimeType` | `string $format` | `?string` | Returns mime type for passed format. Returns `null` if not found. | -| `Formats::can` | `string $format, int $ability` | `boolean` | Check if any driver supports passed ability for passed format | +| `Formats::can` | `string $format, int $ability` | `boolean` | Check if any driver supports passed [ability](#abilities) for passed format | | `Formats::canOpen`, `Formats::canStream`, `Formats::canCreate`, `Formats::canAppend`, `Formats::canUpdate`, `Formats::canEncrypt` | `string $format` | `boolean` | Tests if an archive format can be opened/created/appended (`add`)/updated (`delete`)/created encrypted by any driver with current system and php configuration. | # UnifiedArchive @@ -77,7 +77,7 @@ All methods are static. Opens an archive and returns instance of `UnifiedArchive`. If you provide `$password`, it will be used to open encrypted archive. - If you provide `$abilities`, it will be used to determine driver for format, that supports ALL of passed abilities. + If you provide `$abilities`, it will be used to determine driver for format, that supports ALL of passed [abilities](#abilities). In case of failure (file is not readable or format is not supported or recognized), an `InvalidArgumentException` or `UnsupportedArchiveException` will be thrown. - @@ -92,7 +92,7 @@ All methods are static. UnifiedArchive::can(int $ability): boolean ``` - Checks if current driver supports ability for archive. + Checks if current driver supports [ability](#abilities) for archive. ## Archive information @@ -313,3 +313,17 @@ since the beginning of an era of Unix). - `Formats::UDF` - `Formats::RPM` - `Formats::DEB` + +### Abilities +- `Abilities::OPEN` +- `Abilities::OPEN_ENCRYPTED` +- `Abilities::OPEN_VOLUMED` +- `Abilities::GET_COMMENT` +- `Abilities::EXTRACT_CONTENT` +- `Abilities::STREAM_CONTENT` +- `Abilities::SET_COMMENT` +- `Abilities::APPEND` +- `Abilities::DELETE` +- `Abilities::CREATE` +- `Abilities::CREATE_ENCRYPTED` +- `Abilities::CREATE_IN_STRING` diff --git a/src/Commands/InfoCommand.php b/src/Commands/InfoCommand.php index b650a02..d76aa44 100644 --- a/src/Commands/InfoCommand.php +++ b/src/Commands/InfoCommand.php @@ -34,7 +34,7 @@ public function execute(InputInterface $input, OutputInterface $output) $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); $output->writeln("\t" . 'ratio: ' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%)'); - if ($archive->getDriver()->checkAbility(Abilities::GET_COMMENT) && !empty($comment = $archive->getComment())) + if ($archive->can(Abilities::GET_COMMENT) && !empty($comment = $archive->getComment())) $output->writeln('Comment: ' . $comment . ''); return 0;