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.
35 lines
906 B
35 lines
906 B
<?php
|
|
|
|
namespace App\Parser\DocxParser;
|
|
|
|
use App\Parser\DocxParser\Traits\Helper;
|
|
|
|
class Table
|
|
{
|
|
|
|
use Helper;
|
|
|
|
public function handle($table)
|
|
{
|
|
$result = [];
|
|
foreach ($table->getRows() as $row) {
|
|
$handlerName = "\App\Parser\DocxParser\\".substr(strrchr(__CLASS__, "\\"),
|
|
1).'\\'.$this->getReflectionClass($row);
|
|
$handler = new $handlerName;
|
|
$data = $handler->handle($row);
|
|
if ($data) {
|
|
$result [] = $handler->handle($row);
|
|
}
|
|
}
|
|
|
|
//dd($table->getNestedLevel(),get_class_methods($table));
|
|
//
|
|
return [
|
|
'content' => '',
|
|
'children' => $result,
|
|
'styleDepth' => $table->getNestedLevel() + 1,
|
|
'depth' => $table->getNestedLevel() + 1,
|
|
'type' => 'table',
|
|
];
|
|
}
|
|
}
|