Skip to content

Commit a95215f

Browse files
committed
Use iterator_count() instead of a foreach loop.
1 parent 43da343 commit a95215f

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Node/Node.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,7 @@ public function children(): \Traversable
7171
*/
7272
public function count(): int
7373
{
74-
$count = -1;
75-
76-
foreach ($this->all() as $node) {
77-
++$count;
78-
}
79-
80-
return $count;
74+
return \iterator_count($this->all()) - 1;
8175
}
8276

8377
/**

0 commit comments

Comments
 (0)