@@ -115,7 +115,7 @@ protected static function parseInlineStyle($node, $styles = array())
115
115
// tables, cells
116
116
if (false !== strpos ($ val , '% ' )) {
117
117
// e.g. <table width="100%"> or <td width="50%">
118
- $ styles ['width ' ] = intval ( $ val) * 50 ;
118
+ $ styles ['width ' ] = ( int ) $ val * 50 ;
119
119
$ styles ['unit ' ] = \PhpOffice \PhpWord \SimpleType \TblWidth::PERCENT ;
120
120
} else {
121
121
// e.g. <table width="250> where "250" = 250px (always pixels)
@@ -125,7 +125,7 @@ protected static function parseInlineStyle($node, $styles = array())
125
125
break ;
126
126
case 'cellspacing ' :
127
127
// tables e.g. <table cellspacing="2">, where "2" = 2px (always pixels)
128
- $ val = intval ( $ val). 'px ' ;
128
+ $ val = ( int ) $ val . 'px ' ;
129
129
$ styles ['cellSpacing ' ] = Converter::cssToTwip ($ val );
130
130
break ;
131
131
case 'bgcolor ' :
@@ -693,7 +693,7 @@ protected static function parseStyle($attribute, $styles)
693
693
// This may be adjusted, if better ratio or formula found.
694
694
// BC change: up to ver. 0.17.0 was $size converted to points - Converter::cssToPoint($size)
695
695
$ size = Converter::cssToTwip ($ matches [1 ]);
696
- $ size = intval ($ size / 2 );
696
+ $ size = ( int ) ($ size / 2 );
697
697
// valid variants may be e.g. borderSize, borderTopSize, borderLeftColor, etc ..
698
698
$ styles ["border {$ which }Size " ] = $ size ; // twips
699
699
$ styles ["border {$ which }Color " ] = trim ($ matches [2 ], '# ' );
@@ -871,9 +871,9 @@ protected static function mapAlign($cssAlignment)
871
871
}
872
872
873
873
/**
874
- * Transforms a HTML/CSS alignment into a \PhpOffice\PhpWord\SimpleType\Jc
874
+ * Transforms a HTML/CSS vertical alignment
875
875
*
876
- * @param string $cssAlignment
876
+ * @param string $alignment
877
877
* @return string|null
878
878
*/
879
879
protected static function mapAlignVertical ($ alignment )
@@ -901,10 +901,10 @@ protected static function mapAlignVertical($alignment)
901
901
}
902
902
903
903
/**
904
- * Map list style for ordered list
905
- *
906
- * @param string $cssListType
907
- */
904
+ * Map list style for ordered list
905
+ *
906
+ * @param string $cssListType
907
+ */
908
908
protected static function mapListType ($ cssListType )
909
909
{
910
910
switch ($ cssListType ) {
@@ -959,32 +959,32 @@ protected static function parseLink($node, $element, &$styles)
959
959
}
960
960
961
961
/**
962
- * Render horizontal rule
963
- * Note: Word rule is not the same as HTML's <hr> since it does not support width and thus neither alignment
964
- *
965
- * @param \DOMNode $node
966
- * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
967
- */
962
+ * Render horizontal rule
963
+ * Note: Word rule is not the same as HTML's <hr> since it does not support width and thus neither alignment
964
+ *
965
+ * @param \DOMNode $node
966
+ * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
967
+ */
968
968
protected static function parseHorizRule ($ node , $ element )
969
969
{
970
970
$ styles = self ::parseInlineStyle ($ node );
971
971
972
972
// <hr> is implemented as an empty paragraph - extending 100% inside the section
973
973
// Some properties may be controlled, e.g. <hr style="border-bottom: 3px #DDDDDD solid; margin-bottom: 0;">
974
974
975
- $ fontStyle = $ styles + [ 'size ' => 3 ] ;
975
+ $ fontStyle = $ styles + array ( 'size ' => 3 ) ;
976
976
977
- $ paragraphStyle = $ styles + [
978
- 'lineHeight ' => 0.25 , // multiply default line height - e.g. 1, 1.5 etc
979
- 'spacing ' => 0 , // twip
980
- 'spaceBefore ' => 120 , // twip, 240/2 (default line height)
981
- 'spaceAfter ' => 120 , // twip
982
- 'borderBottomSize ' => empty ($ styles ['line-height ' ]) ? 1 : $ styles ['line-height ' ],
977
+ $ paragraphStyle = $ styles + array (
978
+ 'lineHeight ' => 0.25 , // multiply default line height - e.g. 1, 1.5 etc
979
+ 'spacing ' => 0 , // twip
980
+ 'spaceBefore ' => 120 , // twip, 240/2 (default line height)
981
+ 'spaceAfter ' => 120 , // twip
982
+ 'borderBottomSize ' => empty ($ styles ['line-height ' ]) ? 1 : $ styles ['line-height ' ],
983
983
'borderBottomColor ' => empty ($ styles ['color ' ]) ? '000000 ' : $ styles ['color ' ],
984
984
'borderBottomStyle ' => 'single ' , // same as "solid"
985
- ] ;
985
+ ) ;
986
986
987
- $ element ->addText ("" , $ fontStyle , $ paragraphStyle );
987
+ $ element ->addText ('' , $ fontStyle , $ paragraphStyle );
988
988
989
989
// Notes: <hr/> cannot be:
990
990
// - table - throws error "cannot be inside textruns", e.g. lists
0 commit comments