1<?php 2 3namespace dokuwiki\plugin\wordimport\docx; 4 5/** 6 * Paragraphs are the basic building blocks of a Word document 7 */ 8abstract class AbstractParagraph 9{ 10 /** @var DocX The main object holding everything together */ 11 protected $docx; 12 /** @var \SimpleXMLElement The paragraph object */ 13 protected $p; 14 15 /** 16 * @param DocX $docx The main docx object for accessing shared data 17 * @param \SimpleXMLElement $p The paragraph XML element 18 */ 19 public function __construct(DocX $docx, \SimpleXMLElement $p) 20 { 21 $this->docx = $docx; 22 $this->p = $p; 23 } 24 25 /** 26 * Parse the paragraph XML element 27 */ 28 abstract public function parse(); 29 30 /** 31 * @return string The DokuWiki syntax representation of the paragraph 32 */ 33 abstract public function __toString(): string; 34 35 /** 36 * Allows to merge this paragraph with the previous one if that was of the same type 37 * 38 * This means instead of adding two lines only one is added between the two paragraphs. Used 39 * for example for list items. 40 * 41 * @return bool 42 */ 43 public function mergeToPrevious(): bool 44 { 45 return false; 46 } 47} 48