Unzip final readonly class
Minn\Ops\Unzip · public/minn/src/Minn/Ops/Unzip.php · 112 lines
An archive unpacked as unzip_file() unpacks it (probe unzip-file): into the destination through the filesystem the site set up, every folder made first (the destination and its missing parents included), resource-fork entries (__MACOSX/) and entries whose names climb out or are absolute left out; refused when the disk cannot take twice the unpacked size and a little more. pre_unzip_file may answer first, and unzip_file is handed the result, each with the folders to make and the space needed. An archive the reader cannot open is refused in the words of the library the reference falls back to.
Constants and properties
| private | readonly object $filesystem | Promoted from the constructor. |
| private | readonly Closure $filter | Promoted from the constructor. |
| private | readonly int $dirMode | Promoted from the constructor. |
| private | readonly int $fileMode | Promoted from the constructor. |
Public
| new | __construct(object $filesystem, Closure $filter, int $dirMode, int $fileMode)# |
| ||||||
| static | valid(string $file): bool# | Whether a file is a zip archive that opens and passes its consistency check (wp_zip_file_is_valid). | ||||||
| method | into(string $file, string $to): mixed# | The archive's files under the destination: true, a refusal, or what pre_unzip_file answered instead. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | read(ZipArchive $archive): array# | The entries to write, the folders they need (each archive folder and every parent of a file), and their unpacked size. @return array{0: array<int, string>, 1: list<string>, 2: int} index => name, folders, bytes | |||
| private | safe(string $name): bool# | Whether an entry's name stays inside the destination: no climbing segment, not absolute, no drive. | |||
| private | write(ZipArchive $archive, array $entries, string $to, array $needed): Minn\Runtime\Refusal|true# |
|
Nothing matches.