@@ -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 ' :
@@ -729,7 +729,7 @@ protected static function parseStyle($attribute, $styles)
729
729
// This may be adjusted, if better ratio or formula found.
730
730
// BC change: up to ver. 0.17.0 was $size converted to points - Converter::cssToPoint($size)
731
731
$ size = Converter::cssToTwip ($ matches [1 ]);
732
- $ size = intval ($ size / 2 );
732
+ $ size = ( int ) ($ size / 2 );
733
733
// valid variants may be e.g. borderSize, borderTopSize, borderLeftColor, etc ..
734
734
$ styles ["border {$ which }Size " ] = $ size ; // twips
735
735
$ styles ["border {$ which }Color " ] = trim ($ matches [2 ], '# ' );
@@ -907,9 +907,9 @@ protected static function mapAlign($cssAlignment)
907
907
}
908
908
909
909
/**
910
- * Transforms a HTML/CSS alignment into a \PhpOffice\PhpWord\SimpleType\Jc
910
+ * Transforms a HTML/CSS vertical alignment
911
911
*
912
- * @param string $cssAlignment
912
+ * @param string $alignment
913
913
* @return string|null
914
914
*/
915
915
protected static function mapAlignVertical ($ alignment )
@@ -937,10 +937,10 @@ protected static function mapAlignVertical($alignment)
937
937
}
938
938
939
939
/**
940
- * Map list style for ordered list
941
- *
942
- * @param string $cssListType
943
- */
940
+ * Map list style for ordered list
941
+ *
942
+ * @param string $cssListType
943
+ */
944
944
protected static function mapListType ($ cssListType )
945
945
{
946
946
switch ($ cssListType ) {
@@ -995,32 +995,32 @@ protected static function parseLink($node, $element, &$styles)
995
995
}
996
996
997
997
/**
998
- * Render horizontal rule
999
- * Note: Word rule is not the same as HTML's <hr> since it does not support width and thus neither alignment
1000
- *
1001
- * @param \DOMNode $node
1002
- * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
1003
- */
998
+ * Render horizontal rule
999
+ * Note: Word rule is not the same as HTML's <hr> since it does not support width and thus neither alignment
1000
+ *
1001
+ * @param \DOMNode $node
1002
+ * @param \PhpOffice\PhpWord\Element\AbstractContainer $element
1003
+ */
1004
1004
protected static function parseHorizRule ($ node , $ element )
1005
1005
{
1006
1006
$ styles = self ::parseInlineStyle ($ node );
1007
1007
1008
1008
// <hr> is implemented as an empty paragraph - extending 100% inside the section
1009
1009
// Some properties may be controlled, e.g. <hr style="border-bottom: 3px #DDDDDD solid; margin-bottom: 0;">
1010
1010
1011
- $ fontStyle = $ styles + [ 'size ' => 3 ] ;
1011
+ $ fontStyle = $ styles + array ( 'size ' => 3 ) ;
1012
1012
1013
- $ paragraphStyle = $ styles + [
1014
- 'lineHeight ' => 0.25 , // multiply default line height - e.g. 1, 1.5 etc
1015
- 'spacing ' => 0 , // twip
1016
- 'spaceBefore ' => 120 , // twip, 240/2 (default line height)
1017
- 'spaceAfter ' => 120 , // twip
1018
- 'borderBottomSize ' => empty ($ styles ['line-height ' ]) ? 1 : $ styles ['line-height ' ],
1013
+ $ paragraphStyle = $ styles + array (
1014
+ 'lineHeight ' => 0.25 , // multiply default line height - e.g. 1, 1.5 etc
1015
+ 'spacing ' => 0 , // twip
1016
+ 'spaceBefore ' => 120 , // twip, 240/2 (default line height)
1017
+ 'spaceAfter ' => 120 , // twip
1018
+ 'borderBottomSize ' => empty ($ styles ['line-height ' ]) ? 1 : $ styles ['line-height ' ],
1019
1019
'borderBottomColor ' => empty ($ styles ['color ' ]) ? '000000 ' : $ styles ['color ' ],
1020
1020
'borderBottomStyle ' => 'single ' , // same as "solid"
1021
- ] ;
1021
+ ) ;
1022
1022
1023
- $ element ->addText ("" , $ fontStyle , $ paragraphStyle );
1023
+ $ element ->addText ('' , $ fontStyle , $ paragraphStyle );
1024
1024
1025
1025
// Notes: <hr/> cannot be:
1026
1026
// - table - throws error "cannot be inside textruns", e.g. lists
0 commit comments