/** * Clears some properties for the next use. */ public function clear() { if (!is_null($this->pageFlowInstance)) { if ($this->pageFlowInstance->isInFinalState()) { $this->pageFlowInstanceRepository->remove($this->pageFlowInstance); } } if (!is_null($this->garbageCollector)) { $pageFlowInstanceRepository = $this->pageFlowInstanceRepository; $this->garbageCollector->sweep(function ($pageFlowInstanceID) use($pageFlowInstanceRepository) { $pageFlowInstance = $pageFlowInstanceRepository->findByID($pageFlowInstanceID); if (!is_null($pageFlowInstance)) { $pageFlowInstance->removePageFlow(); } }); } }