Exemplo n.º 1
0
 /**
  * Creates a specific dot-graph edge for the given state-transition.
  *
  * @param TransitionInterface $transition
  * @param string $state_name
  * @param string $event_name
  *
  * @return string
  */
 protected function createEdge(TransitionInterface $transition, $state_name, $event_name)
 {
     $from_node = $this->node_id_map[$state_name];
     $to_node = $this->node_id_map[$transition->getOutgoingStateName()];
     $transition_label = $event_name === StateMachine::SEQ_TRANSITIONS_KEY ? '' : $event_name;
     if ($transition->hasGuard()) {
         $transition_label .= $transition->getGuard();
     }
     $attributes = [sprintf('label="%s"', trim(addslashes($transition_label))), sprintf('fontname="%s"', $this->getStyle('edge.fontname', self::EDGE_FONTNAME)), sprintf('fontsize="%s"', $this->getStyle('edge.fontsize', self::EDGE_FONTSIZE)), sprintf('fontcolor="%s"', $this->getStyle('edge.fontcolor', self::EDGE_FONTCOLOR))];
     $attributes[] = sprintf('color="%s"', $this->getEdgeColor($event_name));
     return sprintf('%s -> %s [%s]', $from_node, $to_node, implode(' ', $attributes));
 }