getElements($list); if (count($listElements)) { foreach ($listElements as $index => $element) { //dd($element->getFontStyle()); try { $handler = $this->getHandler($element); $data = $handler->handle($element); if ($data && isset($data[ 'content' ]) && strlen(trim(strip_tags($data[ 'content' ])))) { $styleName = $list->getParagraphStyle()->getStyleName(); if ($index === 0) { $result[] = [ 'content' => $data, 'type' => 'listItemRun', 'depth' => (int) $list->getDepth(), 'styleDepth' => $this->getStyleListDepth($styleName), 'styleName' => $styleName, 'index' => $list->getElementIndex(), 'children' => [] ]; } else { if (isset($result[ count($result) - 1 ])) { $result[ count($result) - 1 ][ 'content' ][ 'content' ] .= ' '.$data[ 'content' ]; } else { $result[] = [ 'content' => $data, 'type' => 'listItemRun', 'depth' => (int) $list->getDepth(), 'styleDepth' => $this->getStyleListDepth($styleName), 'styleName' => $styleName, 'index' => $list->getElementIndex(), 'children' => [] ]; } } } } catch (Exception $e) { throw new Exception($e->getMessage()); } } if ($result) { if (count($result) === 1) { $result = reset($result); $result[ 'content' ][ 'content' ] = '
'.$result[ 'content' ][ 'content' ].'
'; } } } return $result; } }