Repo for the search and displace ingest module that takes odf, docx and pdf and transforms it into .md to be used with search and displace operations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.0 KiB

<?php
namespace App\Ingest;
use Illuminate\Support\Facades\Storage;
class Convertor
{
/**
* @var \Illuminate\Contracts\Filesystem\Filesystem
*/
private $storage;
private $path;
protected $type;
public function __construct($path, $type)
{
$this->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();
}
}