Skip to content

Commit 355027d

Browse files
committed
PHP-CS fix, improve code coverage
1 parent 2ea9ffb commit 355027d

File tree

5 files changed

+7
-32
lines changed

5 files changed

+7
-32
lines changed

src/PhpWord/Writer/ODText/Element/Link.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\ODText\Element;
1919

20-
use PhpOffice\PhpWord\Settings;
21-
2220
/**
2321
* Text element writer
2422
*
@@ -44,11 +42,7 @@ public function write()
4442
$xmlWriter->startElement('text:a');
4543
$xmlWriter->writeAttribute('xlink:type', 'simple');
4644
$xmlWriter->writeAttribute('xlink:href', $element->getSource());
47-
if (Settings::isOutputEscapingEnabled()) {
48-
$xmlWriter->text($element->getText());
49-
} else {
50-
$xmlWriter->writeRaw($element->getText());
51-
}
45+
$this->writeText($element->getText());
5246
$xmlWriter->endElement(); // text:a
5347

5448
if (!$this->withoutP) {

src/PhpWord/Writer/ODText/Element/PageBreak.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* file that was distributed with this source code. For the full list of
1111
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
1212
*
13-
* @link https://github.com/PHPOffice/PHPWord
14-
* @copyright 2010-2016 PHPWord contributors
13+
* @see https://github.com/PHPOffice/PHPWord
14+
* @copyright 2010-2017 PHPWord contributors
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

src/PhpWord/Writer/ODText/Element/Text.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ public function write()
5858
} elseif (is_string($paragraphStyle)) {
5959
$xmlWriter->writeAttribute('text:style-name', $paragraphStyle);
6060
}
61-
if (Settings::isOutputEscapingEnabled()) {
62-
$xmlWriter->text($element->getText());
63-
} else {
64-
$xmlWriter->writeRaw($element->getText());
65-
}
61+
$this->writeText($element->getText());
6662
} else {
6763
if (empty($paragraphStyle)) {
6864
$xmlWriter->writeAttribute('text:style-name', 'Standard');
@@ -74,11 +70,7 @@ public function write()
7470
if (is_string($fontStyle)) {
7571
$xmlWriter->writeAttribute('text:style-name', $fontStyle);
7672
}
77-
if (Settings::isOutputEscapingEnabled()) {
78-
$xmlWriter->text($element->getText());
79-
} else {
80-
$xmlWriter->writeRaw($element->getText());
81-
}
73+
$this->writeText($element->getText());
8274
$xmlWriter->endElement();
8375
}
8476
if (!$this->withoutP) {

src/PhpWord/Writer/ODText/Element/Title.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\ODText\Element;
1919

20-
use PhpOffice\PhpWord\Settings;
21-
2220
/**
2321
* Title element writer
2422
*
@@ -39,11 +37,7 @@ public function write()
3937

4038
$xmlWriter->startElement('text:h');
4139
$xmlWriter->writeAttribute('text:outline-level', $element->getDepth());
42-
if (Settings::isOutputEscapingEnabled()) {
43-
$xmlWriter->text($element->getText());
44-
} else {
45-
$xmlWriter->writeRaw($element->getText());
46-
}
40+
$this->writeText($element->getText());
4741
$xmlWriter->endElement(); // text:h
4842
}
4943
}

src/PhpWord/Writer/ODText/Part/Meta.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
namespace PhpOffice\PhpWord\Writer\ODText\Part;
1919

2020
use PhpOffice\Common\XMLWriter;
21-
use PhpOffice\PhpWord\Settings;
2221

2322
/**
2423
* ODText meta part writer: meta.xml
@@ -100,11 +99,7 @@ private function writeCustomProperty(XMLWriter $xmlWriter, $property, $value)
10099
// if ($type !== null) {
101100
// $xmlWriter->writeAttribute('meta:value-type', $type);
102101
// }
103-
if (Settings::isOutputEscapingEnabled()) {
104-
$xmlWriter->text($value);
105-
} else {
106-
$xmlWriter->writeRaw($value);
107-
}
102+
$this->writeText($value);
108103
$xmlWriter->endElement(); // meta:user-defined
109104
}
110105
}

0 commit comments

Comments
 (0)