public function filter($filterFunction) { $newCollection = new ResultCollection(); foreach ($this->elements as $element) { if ($filterFunction($element)) { $newCollection->add($element); } } return $newCollection; }
public function parseList($urls) { $out = new ResultCollection(); foreach ($urls as $url) { try { $out->add($this->parse($url)); } catch (\Exception $ex) { // skip exceptions } } return $out; }