Skip to content

Commit 70ad015

Browse files
committed
Make scrunitizer happier
1 parent 38788e0 commit 70ad015

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ protected static function parseInlineStyle($node, $styles = array())
9696
$attributes = $node->attributes; // get all the attributes(eg: id, class)
9797

9898
foreach ($attributes as $attribute) {
99-
$val = trim($attribute->value);
99+
$val = $attribute->value;
100100
switch (strtolower($attribute->name)) {
101101
case 'style':
102102
$styles = self::parseStyle($attribute, $styles);
103103
break;
104104
case 'align':
105-
$styles['alignment'] = self::mapAlign($val);
105+
$styles['alignment'] = self::mapAlign(trim($val));
106106
break;
107107
case 'lang':
108108
$styles['lang'] = $val;
@@ -121,7 +121,7 @@ protected static function parseInlineStyle($node, $styles = array())
121121
break;
122122
case 'cellspacing':
123123
// tables e.g. <table cellspacing="2">, where "2" = 2px (always pixels)
124-
$val = intval($attribute->value).'px';
124+
$val = intval($val).'px';
125125
$styles['cellSpacing'] = Converter::cssToTwip($val);
126126
break;
127127
case 'bgcolor':
@@ -475,7 +475,8 @@ protected static function parseList($node, $element, &$styles, &$data)
475475
if ($start > 0) {
476476
$level->setStart($start);
477477
}
478-
if ($type && !!($type = self::mapListType($type))) {
478+
$type = $type ? self::mapListType($type) : null;
479+
if ($type) {
479480
$level->setFormat($type);
480481
}
481482
}

0 commit comments

Comments
 (0)