{spl_object_hash($thread)} = $thread; } } /** * @param Worker|Thread $thread */ public function remove($thread){ if($thread instanceof Thread or $thread instanceof Worker){ unset($this->{spl_object_hash($thread)}); } } /** * @return Worker[]|Thread[] */ public function getAll(){ $array = []; foreach($this as $key => $thread){ $array[$key] = $thread; } return $array; } }