コード例 #1
0
 /**
  * @param array $context
  *
  * @return string
  */
 protected function createLoggerMessage(array $context)
 {
     $message = 'Transition';
     if (isset($context[self::CONTEXT_SUBJECT])) {
         $message .= ' for "' . $this->stringConverter->convertToString($context[self::CONTEXT_SUBJECT]) . '"';
     }
     if (isset($context[self::CONTEXT_LAST_STATE])) {
         $message .= ' from "' . $this->stringConverter->convertToString($context[self::CONTEXT_LAST_STATE]) . '"';
     }
     if (isset($context[self::CONTEXT_CURRENT_STATE])) {
         $message .= ' to "' . $this->stringConverter->convertToString($context[self::CONTEXT_CURRENT_STATE]) . '"';
     }
     if (isset($context[self::CONTEXT_TRANSITION])) {
         /* @var $transition TransitionInterface */
         $transition = $context[self::CONTEXT_TRANSITION];
         $eventName = $transition->getEventName();
         $condition = $transition->getConditionName();
         if ($eventName || $condition) {
             $message .= ' with';
             if ($eventName) {
                 $message .= ' event "' . $eventName . '"';
             }
             if ($eventName) {
                 $message .= ' condition "' . $condition . '"';
             }
         }
     }
     return $message;
 }
コード例 #2
0
ファイル: GraphBuilder.php プロジェクト: metabor/statemachine
 /**
  * @param EventInterface $event
  *
  * @return string
  */
 protected function convertObserverToString(EventInterface $event)
 {
     $observers = array();
     foreach ($event->getObservers() as $observer) {
         $observers[] = $this->stringConverter->convertToString($observer);
     }
     return implode(', ', $observers);
 }
コード例 #3
0
ファイル: MutexFactory.php プロジェクト: metabor/statemachine
 /**
  * @param $subject
  * @return MutexInterface
  */
 public function createMutex($subject)
 {
     return new LockAdapterMutex($this->lockAdapter, $this->stringConverter->convertToString($subject));
 }