view = $view; $this->zip_generator = $zip_generator; $this->files = $files; $this->filesystem = $filesystem; } /** * Zip. * * @since 3.5.0 * * @throws \RuntimeException If the zip cannot be created */ public function zip(): void { $this->zip_generator->zip(); } /** * Zip File Path. * * @since 3.5.0 * * @return string The file path */ public function path() { return $this->zip_generator->path(); } /** * Clean the Controller. * * @since 3.5.0 */ public function clean(): void { $this->filesystem->delete( $this->zip_generator->path() ); } /** * Downloader View. * * @since 3.5.0 */ public function view(): void { $this->view->view(); } /** * Can be Downloaded. * * @since 3.5.0 * * @return bool true if the file can be downloaded, false otherwise */ public function can_be_downloaded(): bool { foreach ($this->files as $file) { if (file_exists($file)) { return true; } } return false; } }