/** * Return this collection minus the elements of the passed collection * * @param $collec Another Collection containing the same class of elements */ public function diff(Collection $collec) { if (empty($this->className)) { $this->className = $collec->className(); } foreach ($collec->collected as $id => $c) { if ($this->get($id)) { $this->remove($id); } } return $this; }