Skip to content

Commit ec9d900

Browse files
committed
Refactor: Fine tune element writing
1 parent 2567a22 commit ec9d900

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/PhpWord/Writer/ODText/Content.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use PhpOffice\PhpWord\Media;
1313
use PhpOffice\PhpWord\Style;
1414
use PhpOffice\PhpWord\PhpWord;
15+
use PhpOffice\PhpWord\Element\Text;
16+
use PhpOffice\PhpWord\Element\Table;
1517
use PhpOffice\PhpWord\Exception\Exception;
1618
use PhpOffice\PhpWord\Shared\XMLWriter;
1719
use PhpOffice\PhpWord\Style\Font;

src/PhpWord/Writer/RTF.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
namespace PhpOffice\PhpWord\Writer;
1111

1212
use PhpOffice\PhpWord\PhpWord;
13+
use PhpOffice\PhpWord\Style;
14+
use PhpOffice\PhpWord\Element\Text;
1315
use PhpOffice\PhpWord\Exception\Exception;
1416
use PhpOffice\PhpWord\Shared\Drawing;
15-
use PhpOffice\PhpWord\Style;
1617
use PhpOffice\PhpWord\Style\Font;
1718
use PhpOffice\PhpWord\Writer\RTF\Element\Element as ElementWriter;
1819

@@ -99,23 +100,23 @@ public function getFontTable()
99100
}
100101

101102
/**
102-
* Set last paragraph style
103+
* Get last paragraph style
103104
*
104105
* @param mixed $value
105106
*/
106-
public function setLastParagraphStyle($value = '')
107+
public function getLastParagraphStyle()
107108
{
108-
$this->lastParagraphStyle = $value;
109+
return $this->lastParagraphStyle;
109110
}
110111

111112
/**
112-
* Get last paragraph style
113+
* Set last paragraph style
113114
*
114115
* @param mixed $value
115116
*/
116-
public function getLastParagraphStyle()
117+
public function setLastParagraphStyle($value = '')
117118
{
118-
return $this->lastParagraphStyle;
119+
$this->lastParagraphStyle = $value;
119120
}
120121

121122
/**
@@ -125,8 +126,8 @@ public function getLastParagraphStyle()
125126
*/
126127
private function writeDocument()
127128
{
128-
$this->fontTable = $this->getDataFont();
129-
$this->colorTable = $this->getDataColor();
129+
$this->fontTable = $this->populateFontTable();
130+
$this->colorTable = $this->populateColorTable();
130131

131132
// Set the default character set
132133
$sRTFContent = '{\rtf1';
@@ -200,7 +201,7 @@ private function writeContent()
200201
*
201202
* @return array
202203
*/
203-
private function getDataFont()
204+
private function populateFontTable()
204205
{
205206
$phpWord = $this->phpWord;
206207

@@ -254,7 +255,7 @@ private function getDataFont()
254255
*
255256
* @return array
256257
*/
257-
private function getDataColor()
258+
private function populateColorTable()
258259
{
259260
$phpWord = $this->phpWord;
260261

0 commit comments

Comments
 (0)