Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * @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);
 }
Exemplo n.º 3
0
 /**
  * @param $subject
  * @return MutexInterface
  */
 public function createMutex($subject)
 {
     return new LockAdapterMutex($this->lockAdapter, $this->stringConverter->convertToString($subject));
 }