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.
 
 
 
 

41 lines
894 B

<?php
namespace App\Parser\DocxParser;
use App\Parser\DocxParser\Traits\Helper;
use Exception;
use PhpOffice\PhpWord\Element\Section as WordSection;
class Section
{
use Helper;
public function handle($section)
{
$result = [];
if ($section instanceof WordSection) {
$sectionElements = $this->getElements($section);
foreach ($sectionElements as $element) {
try {
$handler = $this->getHandler($element);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
$data = $handler->handle($element);
if($data){
$result[] = $handler->handle($element);
}
}
}
if (count($result) > 0) {
return $result;
}
return;
}
}