File tree Expand file tree Collapse file tree 7 files changed +35
-29
lines changed Expand file tree Collapse file tree 7 files changed +35
-29
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ class Font extends AbstractStyle
248
248
/**
249
249
* Languages
250
250
*
251
- * @var \PhpOffice\PhpWord\Style\Language
251
+ * @var \PhpOffice\PhpWord\Style\Language|null
252
252
*/
253
253
private $ lang ;
254
254
@@ -856,7 +856,7 @@ public function setShading($value = null)
856
856
/**
857
857
* Get language
858
858
*
859
- * @return \PhpOffice\PhpWord\Style\Language
859
+ * @return \PhpOffice\PhpWord\Style\Language|null
860
860
*/
861
861
public function getLang ()
862
862
{
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ class Paragraph extends Border
85
85
/**
86
86
* Indentation
87
87
*
88
- * @var \PhpOffice\PhpWord\Style\Indentation
88
+ * @var \PhpOffice\PhpWord\Style\Indentation|null
89
89
*/
90
90
private $ indentation ;
91
91
@@ -99,7 +99,7 @@ class Paragraph extends Border
99
99
/**
100
100
* Text line height
101
101
*
102
- * @var int
102
+ * @var int|float|null
103
103
*/
104
104
private $ lineHeight ;
105
105
@@ -343,9 +343,9 @@ public function setNext($value = null)
343
343
}
344
344
345
345
/**
346
- * Get shading
346
+ * Get indentation
347
347
*
348
- * @return \PhpOffice\PhpWord\Style\Indentation
348
+ * @return \PhpOffice\PhpWord\Style\Indentation|null
349
349
*/
350
350
public function getIndentation ()
351
351
{
@@ -519,7 +519,7 @@ public function setSpacingLineRule($value)
519
519
/**
520
520
* Get line height
521
521
*
522
- * @return int|float
522
+ * @return int|float|null
523
523
*/
524
524
public function getLineHeight ()
525
525
{
Original file line number Diff line number Diff line change @@ -86,19 +86,17 @@ public function getContent()
86
86
$ content .= '<!-- Generated by PHPWord --> ' . PHP_EOL ;
87
87
$ langtext = '' ;
88
88
$ phpWord = $ this ->getPhpWord ();
89
- if ($ phpWord ) {
90
- $ lang = $ phpWord ->getSettings ()->getThemeFontLang ();
91
- if ($ lang ) {
92
- $ lang2 = $ lang ->getLatin ();
93
- if (!$ lang2 ) {
94
- $ lang2 = $ lang ->getEastAsia ();
95
- }
96
- if (!$ lang2 ) {
97
- $ lang2 = $ lang ->getBidirectional ();
98
- }
99
- if ($ lang2 ) {
100
- $ langtext = " lang=' " . $ lang2 . "' " ;
101
- }
89
+ $ lang = $ phpWord ->getSettings ()->getThemeFontLang ();
90
+ if (!empty ($ lang )) {
91
+ $ lang2 = $ lang ->getLatin ();
92
+ if (!$ lang2 ) {
93
+ $ lang2 = $ lang ->getEastAsia ();
94
+ }
95
+ if (!$ lang2 ) {
96
+ $ lang2 = $ lang ->getBidirectional ();
97
+ }
98
+ if ($ lang2 ) {
99
+ $ langtext = " lang=' " . $ lang2 . "' " ;
102
100
}
103
101
}
104
102
$ content .= "<html $ langtext> " . PHP_EOL ;
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ public function write()
76
76
$ content .= $ this ->openingText ;
77
77
$ content .= $ this ->openingTags ;
78
78
if (Settings::isOutputEscapingEnabled ()) {
79
+ // Scrutinizer notes that escapeHTML does not exist on AbstractEscaper.
80
+ // Nevertheless, it does exist for HTML writer.
81
+ /** @scrutinizer ignore-call */
79
82
$ contenx = $ this ->escaper ->escapeHtml ($ element ->getText ());
80
83
} else {
81
84
$ contenx = $ element ->getText ();
@@ -264,10 +267,13 @@ private function getFontStyle()
264
267
$ style = " style= \"$ styl2 \"" ;
265
268
}
266
269
$ lang = $ fontStyle ->getLang ();
267
- } elseif (is_string ($ fontStyle )) {
270
+ } elseif (! empty ($ fontStyle )) {
268
271
$ style = " class= \"$ fontStyle \"" ;
269
272
$ styl2 = Style::getStyle ($ fontStyle );
270
- if ($ styl2 ) {
273
+ if (!empty ($ styl2 )) {
274
+ // Scrutinizer notes that getLang does not exist on Abstract Style.
275
+ // Nevertheless, it does exist for Font Style.
276
+ /** @scrutinizer ignore-call */
271
277
$ lang = $ styl2 ->getLang ();
272
278
}
273
279
}
Original file line number Diff line number Diff line change 18
18
namespace PhpOffice \PhpWord \Writer \HTML \Part ;
19
19
20
20
use PhpOffice \PhpWord \Exception \Exception ;
21
- use PhpOffice \PhpWord \Writer \AbstractWriter ;
21
+ use PhpOffice \PhpWord \Writer \HTML ;
22
22
use Zend \Escaper \Escaper ;
23
23
24
24
/**
27
27
abstract class AbstractPart
28
28
{
29
29
/**
30
- * @var \PhpOffice\PhpWord\Writer\AbstractWriter
30
+ * @var \PhpOffice\PhpWord\Writer\HTML
31
31
*/
32
32
private $ parentWriter ;
33
33
@@ -47,17 +47,17 @@ public function __construct()
47
47
abstract public function write ();
48
48
49
49
/**
50
- * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer
50
+ * @param \PhpOffice\PhpWord\Writer\HTML $writer
51
51
*/
52
- public function setParentWriter (AbstractWriter $ writer = null )
52
+ public function setParentWriter (HTML $ writer = null )
53
53
{
54
54
$ this ->parentWriter = $ writer ;
55
55
}
56
56
57
57
/**
58
58
* @throws \PhpOffice\PhpWord\Exception\Exception
59
59
*
60
- * @return \PhpOffice\PhpWord\Writer\AbstractWriter
60
+ * @return \PhpOffice\PhpWord\Writer\HTML
61
61
*/
62
62
public function getParentWriter ()
63
63
{
Original file line number Diff line number Diff line change @@ -63,7 +63,9 @@ public function write()
63
63
$ css ['display ' ] = $ this ->getValueIf ($ style ->isHidden (), 'none ' );
64
64
65
65
$ whitespace = $ style ->getHtmlWhiteSpace ();
66
- $ css ['white-space ' ] = $ this ->getValueIf ($ whitespace , $ whitespace );
66
+ if ($ whitespace ) {
67
+ $ css ['white-space ' ] = $ whitespace ;
68
+ }
67
69
68
70
$ spacing = $ style ->getSpacing ();
69
71
$ css ['letter-spacing ' ] = $ this ->getValueIf (!is_null ($ spacing ), ($ spacing / 20 ) . 'pt ' );
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ public function write()
94
94
$ css ['margin-right ' ] = ((string ) $ inches ) . 'in ' ;
95
95
}
96
96
}
97
- if ($ style ->getPageBreakBefore ()) {
97
+ if ($ style ->hasPageBreakBefore ()) {
98
98
$ css ['page-break-before ' ] = 'always ' ;
99
99
}
100
100
You can’t perform that action at this time.
0 commit comments