summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2017-11-29 23:36:15 +0000
committerAndres Rey <[email protected]>2017-11-29 23:36:15 +0000
commit90c7291789e29be7a394e1fd1b4d00148525cdc7 (patch)
tree0d4097d57dae8703b63da8ca1a6493a8a6f72912
parent567f3b849bd14ab3d5d8fb4628e0fb1867d2afd9 (diff)
Refactor getAllLinks
-rw-r--r--src/NodeClass/NodeClassTrait.php8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/NodeClass/NodeClassTrait.php b/src/NodeClass/NodeClassTrait.php
index 0749cab..2fc714b 100644
--- a/src/NodeClass/NodeClassTrait.php
+++ b/src/NodeClass/NodeClassTrait.php
@@ -145,13 +145,7 @@ trait NodeClassTrait
if ($this->nodeType === XML_TEXT_NODE) {
return null;
} else {
- $links = [];
- // TODO Better way to do this loop
- foreach ($this->getElementsByTagName('a') as $link) {
- $links[] = $link;
- }
-
- return $links;
+ return iterator_to_array($this->getElementsByTagName('a'));
}
}