@@ -115,7 +115,7 @@ protected static function parseInlineStyle($node, $styles = array())
115115 // tables, cells
116116 if (false !== strpos ($ val , '% ' )) {
117117 // e.g. <table width="100%"> or <td width="50%">
118- $ styles ['width ' ] = intval ( $ val) * 50 ;
118+ $ styles ['width ' ] = ( int ) $ val * 50 ;
119119 $ styles ['unit ' ] = \PhpOffice \PhpWord \SimpleType \TblWidth::PERCENT ;
120120 } else {
121121 // e.g. <table width="250> where "250" = 250px (always pixels)
@@ -125,7 +125,7 @@ protected static function parseInlineStyle($node, $styles = array())
125125 break ;
126126 case 'cellspacing ' :
127127 // tables e.g. <table cellspacing="2">, where "2" = 2px (always pixels)
128- $ val = intval ( $ val). 'px ' ;
128+ $ val = ( int ) $ val . 'px ' ;
129129 $ styles ['cellSpacing ' ] = Converter::cssToTwip ($ val );
130130 break ;
131131 case 'bgcolor ' :
@@ -729,7 +729,7 @@ protected static function parseStyle($attribute, $styles)
729729 // This may be adjusted, if better ratio or formula found.
730730 // BC change: up to ver. 0.17.0 was $size converted to points - Converter::cssToPoint($size)
731731 $ size = Converter::cssToTwip ($ matches [1 ]);
732- $ size = intval ($ size / 2 );
732+ $ size = ( int ) ($ size / 2 );
733733 // valid variants may be e.g. borderSize, borderTopSize, borderLeftColor, etc ..
734734 $ styles ["border {$ which }Size " ] = $ size ; // twips
735735 $ styles ["border {$ which }Color " ] = trim ($ matches [2 ], '# ' );
@@ -907,9 +907,9 @@ protected static function mapAlign($cssAlignment)
907907 }
908908
909909 /**
910- * Transforms a HTML/CSS alignment into a \PhpOffice\PhpWord\SimpleType\Jc
910+ * Transforms a HTML/CSS vertical alignment
911911 *
912- * @param string $cssAlignment
912+ * @param string $alignment
913913 * @return string|null
914914 */
915915 protected static function mapAlignVertical ($ alignment )
@@ -937,10 +937,10 @@ protected static function mapAlignVertical($alignment)
937937 }
938938
939939 /**
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+ */
944944 protected static function mapListType ($ cssListType )
945945 {
946946 switch ($ cssListType ) {
@@ -995,32 +995,32 @@ protected static function parseLink($node, $element, &$styles)
995995 }
996996
997997 /**
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+ */
10041004 protected static function parseHorizRule ($ node , $ element )
10051005 {
10061006 $ styles = self ::parseInlineStyle ($ node );
10071007
10081008 // <hr> is implemented as an empty paragraph - extending 100% inside the section
10091009 // Some properties may be controlled, e.g. <hr style="border-bottom: 3px #DDDDDD solid; margin-bottom: 0;">
10101010
1011- $ fontStyle = $ styles + [ 'size ' => 3 ] ;
1011+ $ fontStyle = $ styles + array ( 'size ' => 3 ) ;
10121012
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 ' ],
10191019 'borderBottomColor ' => empty ($ styles ['color ' ]) ? '000000 ' : $ styles ['color ' ],
10201020 'borderBottomStyle ' => 'single ' , // same as "solid"
1021- ] ;
1021+ ) ;
10221022
1023- $ element ->addText ("" , $ fontStyle , $ paragraphStyle );
1023+ $ element ->addText ('' , $ fontStyle , $ paragraphStyle );
10241024
10251025 // Notes: <hr/> cannot be:
10261026 // - table - throws error "cannot be inside textruns", e.g. lists
0 commit comments