Example #1
0
 /**
  * Activates a page flow instance.
  *
  * @param mixed $payload
  */
 public function activate($payload)
 {
     if (!is_null($this->garbageCollector)) {
         $this->garbageCollector->mark();
     }
     $this->pageFlowInstance = $this->createPageFlowInstance($payload);
     $this->pageFlowInstance->activate($this->continuationContextProvider->getEventID());
     if (!is_null($this->garbageCollector) && !$this->pageFlowInstanceRepository->checkPageFlowIsExclusive($this->pageFlowInstance)) {
         $this->garbageCollector->update($this->pageFlowInstance->getID());
     }
     self::$activeInstances[] = $this;
     if (!self::$shutdownRegistered) {
         self::$shutdownRegistered = true;
         register_shutdown_function(array(__CLASS__, 'shutdown'));
     }
 }
 /**
  * Adds a page flow instance to this repository.
  *
  * @param \Piece\Flow\Continuation\PageFlowInstance $pageFlowInstance
  */
 public function add(PageFlowInstance $pageFlowInstance)
 {
     $exclusivePageFlowInstance = $this->findByPageFlowID($pageFlowInstance->getPageFlowID());
     if (!is_null($exclusivePageFlowInstance)) {
         $this->remove($exclusivePageFlowInstance);
     }
     $this->pageFlowInstances[$pageFlowInstance->getID()] = $pageFlowInstance;
     if ($this->checkPageFlowIsExclusive($pageFlowInstance)) {
         $this->exclusivePageFlowInstances[$pageFlowInstance->getPageFlowID()] = $pageFlowInstance->getID();
     }
 }