storage = Storage::disk('local'); $this->path = $path; $this->type = $type; } /** * @throws \Exception */ public function execute() { if ($this->type === 'txt') { $convertor = new TextConvertor($this->storage, $this->path); } else if ($this->type === 'pdf') { $convertor = new PDFConvertor($this->storage, $this->path); } else if ($this->type === 'docx' || $this->type === 'odt') { $convertor = new DocxAndOdtConvertor($this->storage, $this->path, $this->type); } else { $convertor = new OtherConvertor($this->storage, $this->path); } $convertor->execute(); //$this->convertToHtml(); } }