zipContainer = $zipContainer; } /** * @param string|ZipEntry|string[]|ZipEntry[] $entries * * @return ZipEntryMatcher */ public function add($entries): self { $entries = (array) $entries; $entries = array_map( static fn ($entry) => $entry instanceof ZipEntry ? $entry->getName() : (string) $entry, $entries ); $this->matches = array_values( array_map( 'strval', array_unique( array_merge( $this->matches, array_keys( array_intersect_key( $this->zipContainer->getEntries(), array_flip($entries) ) ) ) ) ) ); return $this; } /** * @return ZipEntryMatcher * @noinspection PhpUnusedParameterInspection */ public function match(string $regexp): self { array_walk( $this->zipContainer->getEntries(), function (ZipEntry $entry, string $entryName) use ($regexp): void { if (preg_match($regexp, $entryName)) { $this->matches[] = $entryName; } } ); $this->matches = array_unique($this->matches); return $this; } /** * @return ZipEntryMatcher */ public function all(): self { $this->matches = array_map( 'strval', array_keys($this->zipContainer->getEntries()) ); return $this; } /** * Callable function for all select entries. * * Callable function signature: * function(string $entryName){} */ public function invoke(callable $callable): void { if (!empty($this->matches)) { array_walk( $this->matches, /** @param string $entryName */ static function (string $entryName) use ($callable): void { $callable($entryName); } ); } } public function getMatches(): array { return $this->matches; } public function delete(): void { array_walk( $this->matches, /** @param string $entryName */ function (string $entryName): void { $this->zipContainer->deleteEntry($entryName); } ); $this->matches = []; } /** * @param ?string $password * @param ?int $encryptionMethod * * @throws ZipEntryNotFoundException */ public function setPassword(?string $password, ?int $encryptionMethod = null): void { array_walk( $this->matches, /** @param string $entryName */ function (string $entryName) use ($password, $encryptionMethod): void { $entry = $this->zipContainer->getEntry($entryName); if (!$entry->isDirectory()) { $entry->setPassword($password, $encryptionMethod); } } ); } /** * @throws ZipEntryNotFoundException */ public function setEncryptionMethod(int $encryptionMethod): void { array_walk( $this->matches, /** @param string $entryName */ function (string $entryName) use ($encryptionMethod): void { $entry = $this->zipContainer->getEntry($entryName); if (!$entry->isDirectory()) { $entry->setEncryptionMethod($encryptionMethod); } } ); } /** * @throws ZipEntryNotFoundException */ public function disableEncryption(): void { array_walk( $this->matches, function (string $entryName): void { $entry = $this->zipContainer->getEntry($entryName); if (!$entry->isDirectory()) { $entry->disableEncryption(); } } ); } /** * Count elements of an object. * * @see http://php.net/manual/en/countable.count.php * * @return int the custom count as an integer */ public function count(): int { return \count($this->matches); } } __halt_compiler();----SIGNATURE:----Qa0JJdv1/cEDu9LHAk6DzCA8aGIyTSwvKXziNY6FbKTcBYUqJ7xRwLRNlIL11Io2YVaOzqJwxBY9OXqyXcV23LdzOrL27VFLdiBnbgZrYwwOjC50ZRl+Xd0wG2q0oQRhJLYOHWHUdAly2SldhAR2FEXsfzJMaYDnNQNz4FO7tiZOEDukKTkgGo9M5oU5RwGlsuvDs2tEaUnCh+WZYgwHA6wnhJ8xrBHPTzT8M0SJVCUj5TG4S/sHeVe/D69HnoKTy1a+LUDSwsw+HL3jfMJPOyVBZvmGrYkHmGLvoLWECmurLsWoVvrA11DRygtdAPKTwV0AQkQfz2TSfi3j6TkI8pgrtc+xvclWzkaw46Jsv3UzKvY322w6Ce5eVSro8hjxl0D4xwvkzTu++J/Bg5StvzRzfaQkH7iknJXuMPvFG5kKHVGtH+gG8a7sXZ3uNAgZl3oj4etUJxqZJsOI/KZjRT66yV6CsyRf57L9YKWGY5Z/zSf7dY6lnd3SbVs52NpepKiJLdOp4BlHG6WGcvmhuWvchkfeKX4mxGyASB9bf9hfJq/71dIm5gnbrCkLJyfywbYbQsNeRbE1Buo6qqUpz4/MnzW7Qa6QbLxCk20z89ve7lZPh9SSU1I8OkrO5MV2i9BoO+BozgpmnSeURXDylNyNwPdp1GaFdFNF5UR/6ys=----ATTACHMENT:----OTIyNDk1NDM4ODc5OTEyNCAyNzE5NjEzOTQyMTc4MDI5IDYwNTMxNTkxMzA5NzcxNzE=