/**
  *
  * @param  object                                         $subject
  * @return \MetaborStd\Statemachine\StatemachineInterface
  */
 public function createStatemachine($subject)
 {
     $process = $this->processDetector->detectProcess($subject);
     if ($this->stateNameDetector) {
         $stateName = $this->stateNameDetector->detectCurrentStateName($subject);
         $statemachine = new Statemachine($subject, $process, $stateName, $this->transitonSelector);
     } else {
         $statemachine = new Statemachine($subject, $process, null, $this->transitonSelector);
     }
     foreach ($this->statemachineObserver as $observer) {
         $statemachine->attach($observer);
     }
     return $statemachine;
 }
Exemple #2
0
 /**
  * @param object $subject
  *
  * @return \MetaborStd\Statemachine\StatemachineInterface
  */
 public function createStatemachine($subject)
 {
     $process = $this->processDetector->detectProcess($subject);
     if ($this->stateNameDetector) {
         $stateName = $this->stateNameDetector->detectCurrentStateName($subject);
     } else {
         $stateName = null;
     }
     if ($this->mutexFactory) {
         $mutex = $this->mutexFactory->createMutex($subject);
     } else {
         $mutex = null;
     }
     $statemachine = new Statemachine($subject, $process, $stateName, $this->transitonSelector, $mutex);
     foreach ($this->statemachineObserver as $observer) {
         $statemachine->attach($observer);
     }
     return $statemachine;
 }