Skip to content

Commit 84e5f6e

Browse files
authored
Merge pull request #3 from bavix/scrutinizer-patch-2
Scrutinizer Auto-Fixes
2 parents 7f12f31 + b874c64 commit 84e5f6e

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

src/AdvancedHtmlDom/AHTMLNode.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ public function after($html)
7373
if ($ref_node = $this->node->nextSibling)
7474
{
7575
$this->node->parentNode->insertBefore($fragment, $ref_node);
76-
}
77-
else
78-
{
76+
} else {
7977
$this->node->parentNode->appendChild($fragment);
8078
}
8179
}
@@ -108,8 +106,7 @@ function($matches) {
108106
public function attributes()
109107
{
110108
$ret = array();
111-
foreach ($this->node->attributes as $attr)
112-
{
109+
foreach ($this->node->attributes as $attr) {
113110
$ret[$attr->nodeName] = $attr->nodeValue;
114111
}
115112

@@ -138,9 +135,7 @@ public function flatten($key = null, $level = 1)
138135
if ($children->length == 0)
139136
{
140137
$ret[$this->decamelize(\implode(' ', \array_filter(array($key, $tag))))] = $this->text;
141-
}
142-
else
143-
{
138+
} else {
144139
$flatten = [];
145140
foreach ($children as $child)
146141
{

src/AdvancedHtmlDom/CSS.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ private static function nth($str, $last = false)
119119
$tokens[] = '((last()-position()+1) mod ' . abs($a) . ') = 0';
120120
}
121121

122-
}
123-
else
124-
{
122+
} else {
125123

126124
if ($a === null)
127125
{
@@ -188,9 +186,7 @@ private static function nth_child($str, $last = false)
188186
{
189187
$tokens[] = "((last()-position()+1) mod " . abs($a) . ") = 0";
190188
}
191-
}
192-
else
193-
{
189+
} else {
194190
if ($a === null)
195191
{
196192
return "count(preceding-sibling::*) = " . ($b - 1);
@@ -483,9 +479,7 @@ public static function translate($str)
483479
if (!isset($first_nav))
484480
{
485481
$first_nav = $token;
486-
}
487-
else
488-
{
482+
} else {
489483
$retval[] = self::translate_nav(\trim($token));
490484
}
491485
break;
@@ -524,9 +518,7 @@ private static function get_expressions($str)
524518
{
525519
$retval[] = \trim($item);
526520
$item = '';
527-
}
528-
else
529-
{
521+
} else {
530522
$item .= $token;
531523
}
532524
}

src/AdvancedHtmlDom/Str.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ public function gsub($regex, $replacement, $limit = -1)
6060
if ($replacement instanceof \Closure)
6161
{
6262
$val = \preg_replace_callback($regex, $replacement, $this->text, $limit);
63-
}
64-
else
65-
{
63+
} else {
6664
$val = \preg_replace($regex, $replacement, $this->text, $limit);
6765
}
6866

0 commit comments

Comments
 (0)