From 78c26bf451fc63d296a0d2f475043185a5696cf9 Mon Sep 17 00:00:00 2001
From: Tony Bogdanov CRAP
-
-
+
+
@@ -87,15 +87,15 @@
- 503.17
+ 498.80
-
-
+
+
@@ -205,11 +205,11 @@
-
+
-
__toString
+ __toString
-
getIterator
+ getIterator
@@ -241,7 +241,7 @@
-
anonymousFunction:292#1280
+ anonymousFunction:294#1289
-
count
+ count
-
get
+ get
-
add
+ add
-
clear
+ clear
-
eq
+ eq
-
first
+ first
-
last
+ last
-
children
+ children
-
append
+ append
-
prepend
+ prepend
-
before
+ before
-
after
+ after
-
wrap
+ wrap
-
wrapInner
+ wrapInner
-
find
+ find
-
addClass
+ addClass
-
removeClass
+ removeClass
-
hasClass
+ hasClass
-
attr
+ attr
-
removeAttr
+ removeAttr
-
text
+ text
-
html
+ html
-
+
@@ -96,7 +96,7 @@
-
+
@@ -432,11 +432,11 @@
-
+
-
isChild
+ isChild
-
get
+ get
-
index
+ index
-
removeChild
+ removeChild
-
clear
+ clear
-
isVoid
+ isVoid
Project Risks
chart.yAxis.axisLabel('Method Complexity');
d3.select('#methodComplexity svg')
- .datum(getComplexityData([[100,1,"SDom\\Node\\CData::__construct<\/a>"],[100,1,"SDom\\Node\\CData::__toString<\/a>"],[100,1,"SDom\\Node\\CData::__clone<\/a>"],[100,2,"SDom\\Node\\CData::parent<\/a>"],[100,4,"SDom\\Node\\CData::attach<\/a>"],[100,3,"SDom\\Node\\CData::detach<\/a>"],[100,1,"SDom\\Node\\CData::clone<\/a>"],[100,1,"SDom\\Node\\Comment::__construct<\/a>"],[100,1,"SDom\\Node\\Comment::__toString<\/a>"],[100,1,"SDom\\Node\\Comment::__clone<\/a>"],[100,2,"SDom\\Node\\Comment::parent<\/a>"],[100,4,"SDom\\Node\\Comment::attach<\/a>"],[100,3,"SDom\\Node\\Comment::detach<\/a>"],[100,1,"SDom\\Node\\Comment::clone<\/a>"],[100,1,"SDom\\Node\\DocType::__construct<\/a>"],[100,1,"SDom\\Node\\DocType::__toString<\/a>"],[100,1,"SDom\\Node\\DocType::__clone<\/a>"],[100,2,"SDom\\Node\\DocType::parent<\/a>"],[100,1,"SDom\\Node\\DocType::attach<\/a>"],[100,1,"SDom\\Node\\DocType::detach<\/a>"],[100,1,"SDom\\Node\\DocType::clone<\/a>"],[100,1,"SDom\\Node\\Element::__construct<\/a>"],[100,5,"SDom\\Node\\Element::__toString<\/a>"],[100,1,"SDom\\Node\\Element::__clone<\/a>"],[100,1,"SDom\\Node\\Element::getTag<\/a>"],[100,1,"SDom\\Node\\Element::hasAttribute<\/a>"],[100,1,"SDom\\Node\\Element::setAttribute<\/a>"],[100,3,"SDom\\Node\\Element::getAttribute<\/a>"],[100,2,"SDom\\Node\\Element::removeAttribute<\/a>"],[100,2,"SDom\\Node\\Element::parent<\/a>"],[100,4,"SDom\\Node\\Element::attach<\/a>"],[100,3,"SDom\\Node\\Element::detach<\/a>"],[100,3,"SDom\\Node\\Element::clone<\/a>"],[100,1,"SDom\\Node\\Element::getIterator<\/a>"],[100,1,"SDom\\Node\\Element::count<\/a>"],[100,3,"SDom\\Node\\Element::insertAfter<\/a>"],[100,3,"SDom\\Node\\Element::insertBefore<\/a>"],[100,1,"SDom\\Node\\Element::isChild<\/a>"],[100,4,"SDom\\Node\\Element::get<\/a>"],[100,2,"SDom\\Node\\Element::index<\/a>"],[100,2,"SDom\\Node\\Element::removeChild<\/a>"],[100,2,"SDom\\Node\\Element::clear<\/a>"],[100,1,"SDom\\Node\\Element::isVoid<\/a>"],[100,1,"SDom\\Node\\Text::__construct<\/a>"],[100,1,"SDom\\Node\\Text::__toString<\/a>"],[100,1,"SDom\\Node\\Text::__clone<\/a>"],[100,2,"SDom\\Node\\Text::parent<\/a>"],[100,4,"SDom\\Node\\Text::attach<\/a>"],[100,3,"SDom\\Node\\Text::detach<\/a>"],[100,1,"SDom\\Node\\Text::clone<\/a>"]], 'Method Complexity'))
+ .datum(getComplexityData([[100,1,"SDom\\Node\\CData::__construct<\/a>"],[100,1,"SDom\\Node\\CData::__toString<\/a>"],[100,1,"SDom\\Node\\CData::__clone<\/a>"],[100,2,"SDom\\Node\\CData::parent<\/a>"],[100,4,"SDom\\Node\\CData::attach<\/a>"],[100,3,"SDom\\Node\\CData::detach<\/a>"],[100,1,"SDom\\Node\\CData::clone<\/a>"],[100,1,"SDom\\Node\\Comment::__construct<\/a>"],[100,1,"SDom\\Node\\Comment::__toString<\/a>"],[100,1,"SDom\\Node\\Comment::__clone<\/a>"],[100,2,"SDom\\Node\\Comment::parent<\/a>"],[100,4,"SDom\\Node\\Comment::attach<\/a>"],[100,3,"SDom\\Node\\Comment::detach<\/a>"],[100,1,"SDom\\Node\\Comment::clone<\/a>"],[100,1,"SDom\\Node\\DocType::__construct<\/a>"],[100,1,"SDom\\Node\\DocType::__toString<\/a>"],[100,1,"SDom\\Node\\DocType::__clone<\/a>"],[100,2,"SDom\\Node\\DocType::parent<\/a>"],[100,1,"SDom\\Node\\DocType::attach<\/a>"],[100,1,"SDom\\Node\\DocType::detach<\/a>"],[100,1,"SDom\\Node\\DocType::clone<\/a>"],[100,1,"SDom\\Node\\Element::__construct<\/a>"],[100,5,"SDom\\Node\\Element::__toString<\/a>"],[100,1,"SDom\\Node\\Element::__clone<\/a>"],[100,1,"SDom\\Node\\Element::getTag<\/a>"],[100,1,"SDom\\Node\\Element::hasAttribute<\/a>"],[100,1,"SDom\\Node\\Element::setAttribute<\/a>"],[100,3,"SDom\\Node\\Element::getAttribute<\/a>"],[100,2,"SDom\\Node\\Element::removeAttribute<\/a>"],[100,2,"SDom\\Node\\Element::parent<\/a>"],[100,4,"SDom\\Node\\Element::attach<\/a>"],[100,3,"SDom\\Node\\Element::detach<\/a>"],[100,3,"SDom\\Node\\Element::clone<\/a>"],[100,1,"SDom\\Node\\Element::getIterator<\/a>"],[100,1,"SDom\\Node\\Element::count<\/a>"],[100,3,"SDom\\Node\\Element::insertAfter<\/a>"],[100,3,"SDom\\Node\\Element::insertBefore<\/a>"],[100,1,"SDom\\Node\\Element::isChild<\/a>"],[100,4,"SDom\\Node\\Element::get<\/a>"],[100,2,"SDom\\Node\\Element::index<\/a>"],[100,2,"SDom\\Node\\Element::removeChild<\/a>"],[100,2,"SDom\\Node\\Element::clear<\/a>"],[100,1,"SDom\\Node\\Element::isVoid<\/a>"],[100,1,"SDom\\Node\\Text::__construct<\/a>"],[100,1,"SDom\\Node\\Text::__toString<\/a>"],[100,1,"SDom\\Node\\Text::__clone<\/a>"],[100,2,"SDom\\Node\\Text::parent<\/a>"],[100,4,"SDom\\Node\\Text::attach<\/a>"],[100,3,"SDom\\Node\\Text::detach<\/a>"],[100,1,"SDom\\Node\\Text::clone<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);
diff --git a/docs/coverage/Node/index.html b/docs/coverage/Node/index.html
index d9b6dd4..bc408d1 100644
--- a/docs/coverage/Node/index.html
+++ b/docs/coverage/Node/index.html
@@ -50,7 +50,7 @@
-
+
-
+
-
+
@@ -87,7 +87,7 @@
- 8
+ 9
-
+
@@ -108,7 +108,7 @@
- 1
+ 2
-
@@ -149,13 +153,13 @@
match
+ match
-
+ namespace SDom;
-
+ use SDom\Node as Dom; use SDom\Node as DomNode; use SDom\SelectorMatcher\AttributeNodeTrait; use SDom\SelectorMatcher\ClassNodeTrait; use SDom\SelectorMatcher\CombinedSelectorNodeTrait; use SDom\SelectorMatcher\ElementNodeTrait;
- use SDom\SelectorMatcher\HashNodeTrait;
+ use Symfony\Component\CssSelector\Node as Css; use Symfony\Component\CssSelector\Node as CssNode; /**
@@ -185,8 +189,8 @@
* A class for matching nodes against selector tokens. */ public static function containsWord(string $word, string $sentence): bool
- {
- return in_array($word, preg_split('/\s+/', $sentence));
+ }
+ return in_array($word, preg_split('/\s+/', $sentence) ?: []); } /**
@@ -194,40 +198,43 @@
* Match the supplied CSS token against the supplied Element node and return TRUE if it is matched. * The $effectiveRoot specifies an Element node part of the hierarchy that is to be considered as root of the tree. * Immediate child nodes will be treated as if they don't have a parent.
- *
- * @param Css\NodeInterface $token
- * @param Dom\Element $node
+ * @param Dom\Element|null $effectiveRoot
+ * @param CssNode\NodeInterface $token
+ * @param DomNode\Element $node * @param DomNode\Element|null $effectiveRoot * @return bool
- */
- public function match(Css\NodeInterface $token, Dom\Element $node, Dom\Element $effectiveRoot = null): bool
- {
- switch (true) {
- case $token instanceof Css\SelectorNode:
- return $this->match($token->getTree(), $node, $effectiveRoot);
-
- case $token instanceof Css\ElementNode:
+ return $this->matchElementNode($token, $node);
+ public function match(
+ CssNode\NodeInterface $token,
+ DomNode\Element $node,
+ DomNode\Element $effectiveRoot = null
+ ): bool {
+ switch (true) {
+ case $token instanceof CssNode\SelectorNode: return $this->match($token->getTree(), $node, $effectiveRoot);
-
- case $token instanceof Css\AttributeNode:
+ return $this->matchAttributeNode($token, $node, $effectiveRoot);
+ case $token instanceof CssNode\ElementNode: return $this->matchElementNode($token, $node);
-
- case $token instanceof Css\ClassNode:
+ return $this->matchClassNode($token, $node, $effectiveRoot);
+ case $token instanceof CssNode\AttributeNode: return $this->matchAttributeNode($token, $node, $effectiveRoot);
-
- case $token instanceof Css\HashNode:
+ return $this->matchHashNode($token, $node, $effectiveRoot);
+ case $token instanceof CssNode\ClassNode: return $this->matchClassNode($token, $node, $effectiveRoot);
-
- case $token instanceof Css\CombinedSelectorNode:
+ return $this->matchCombinedSelectorNode($token, $node, $effectiveRoot);
+ case $token instanceof CssNode\HashNode: return $this->matchHashNode($token, $node, $effectiveRoot);
-
- default:
- throw new \RuntimeException(sprintf(
- 'Selector token %s is not supported yet.',
- get_class($token)
- ));
- }
- }
+ }
+ case $token instanceof CssNode\CombinedSelectorNode:
+ return $this->matchCombinedSelectorNode($token, $node, $effectiveRoot);
+
+ default:
+ throw new \RuntimeException(sprintf(
+ 'Selector token %s is not supported yet.',
+ get_class($token)
+ ));
+ }
+ }
@@ -240,7 +247,7 @@ } Legend
Dead Code
- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/AttributeNodeTrait.php.html b/docs/coverage/SelectorMatcher/AttributeNodeTrait.php.html index d4f1537..3652127 100644 --- a/docs/coverage/SelectorMatcher/AttributeNodeTrait.php.html +++ b/docs/coverage/SelectorMatcher/AttributeNodeTrait.php.html @@ -141,9 +141,9 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/ClassNodeTrait.php.html b/docs/coverage/SelectorMatcher/ClassNodeTrait.php.html index f8820f4..f09c362 100644 --- a/docs/coverage/SelectorMatcher/ClassNodeTrait.php.html +++ b/docs/coverage/SelectorMatcher/ClassNodeTrait.php.html @@ -141,9 +141,9 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/CombinedSelectorNodeTrait.php.html b/docs/coverage/SelectorMatcher/CombinedSelectorNodeTrait.php.html index 763c8f5..7212831 100644 --- a/docs/coverage/SelectorMatcher/CombinedSelectorNodeTrait.php.html +++ b/docs/coverage/SelectorMatcher/CombinedSelectorNodeTrait.php.html @@ -245,8 +245,8 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/ElementNodeTrait.php.html b/docs/coverage/SelectorMatcher/ElementNodeTrait.php.html index 66fcefc..a05ce61 100644 --- a/docs/coverage/SelectorMatcher/ElementNodeTrait.php.html +++ b/docs/coverage/SelectorMatcher/ElementNodeTrait.php.html @@ -141,8 +141,8 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/HashNodeTrait.php.html b/docs/coverage/SelectorMatcher/HashNodeTrait.php.html index 734ddf9..aa75531 100644 --- a/docs/coverage/SelectorMatcher/HashNodeTrait.php.html +++ b/docs/coverage/SelectorMatcher/HashNodeTrait.php.html @@ -141,8 +141,8 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/SelectorMatcher/dashboard.html b/docs/coverage/SelectorMatcher/dashboard.html index 8a3481a..1abc79b 100644 --- a/docs/coverage/SelectorMatcher/dashboard.html +++ b/docs/coverage/SelectorMatcher/dashboard.html @@ -137,7 +137,7 @@- Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:08:03 EEST 2018. + Generated by php-code-coverage 5.3.0-1-g982ce79 using PHP 7.2.2 with Xdebug 2.6.0 and PHPUnit 6.5.5 at Sun Apr 1 22:43:17 EEST 2018.
diff --git a/docs/coverage/dashboard.html b/docs/coverage/dashboard.html index b3558a0..e6b8119 100644 --- a/docs/coverage/dashboard.html +++ b/docs/coverage/dashboard.html @@ -75,7 +75,7 @@