filter = $filter; } public function getIterator(): ArrayIterator { if ($this->nodes === null) { $membersQuery = DependencyNode::on($this->getDb()) ->with([ 'host', 'host.state', 'service', 'service.state', 'service.host' ]) ->filter($this->filter); $this->applyRestrictions($membersQuery); $nodes = []; foreach ($membersQuery as $node) { $nodes[] = $node->service_id !== null ? $node->service : $node->host; } $this->nodes = new ArrayIterator($nodes); } return $this->nodes; } public function getFilter(): Filter\Rule { return $this->filter; } public function count(): int { return $this->getIterator()->count(); } public function getModel() { return new Host(); } }