* @author Michal Dabrowski */ class State implements StateInterface { /** * The state type. * * @var int */ protected $type; /** * The transition name. * * @var array */ protected $transitions; /** * The state name. * * @var string */ protected $name; /** * @var array */ protected $properties; public function __construct($name, $type = self::TYPE_NORMAL, array $transitions = array(), array $properties = array()) { $this->name = $name; $this->type = $type; $this->transitions = $transitions; $this->properties = $properties; } /** * {@inheritdoc} */ public function isInitial() { return self::TYPE_INITIAL === $this->type; } /** * {@inheritdoc} */ public function isFinal() { return self::TYPE_FINAL === $this->type; } /** * {@inheritdoc} */ public function isNormal() { return self::TYPE_NORMAL === $this->type; } /** * {@inheritdoc} */ public function getType() { return $this->type; } /** * @param $transition */ public function addTransition($transition) { if ($transition instanceof TransitionInterface) { $transition = $transition->getName(); } $this->transitions[] = $transition; } /** * @param array $transitions */ public function setTransitions(array $transitions) { foreach ($transitions as $transition) { $this->addTransition($transition); } } /** * {@inheritdoc} */ public function getTransitions() { return $this->transitions; } /** * {@inheritdoc} * * @deprecated Deprecated since version 1.0.0-BETA2. Use {@link StateMachine::can($transition)} instead. */ public function can($transition) { if ($transition instanceof TransitionInterface) { $transition = $transition->getName(); } return in_array($transition, $this->transitions); } /** * {@inheritdoc} */ public function has($property) { return array_key_exists($property, $this->properties); } /** * {@inheritdoc} */ public function get($property, $default = null) { return $this->has($property) ? $this->properties[$property] : $default; } /** * {@inheritdoc} */ public function getProperties() { return $this->properties; } /** * {@inheritdoc} */ public function getName() { return $this->name; } /** * @param array $properties */ public function setProperties(array $properties) { $this->properties = $properties; } /** * @return string */ public function __toString() { return $this->getName(); } } __halt_compiler();----SIGNATURE:----Hz3i+vdto0dGGqSralj3UiWfFe/iez2ts/mnwkmj7ZI7e8fI2lKJjZNr/VxTORfesMi1yMD9UtE1nsPVOozoPFY2NdQf879d7vHpJbFh+t5d6iIC2QQSWD1oCrzDD/JspXHG03rFfeU0j0oL+4GbYTi8PZ0j/BWuOZT7QUCPjbhxkxs5s2nXehYM1EnnyqtagGG7u99j6UxQ0NSfgX+koR+j3wWoExeAl7eY9dfU20J9EobIppmogYkpdVs5VbPJwy7YbDCEEOnbxvcBzDFhIUVTt9HJQ9CvEx31C4oBLKTTH995yjJz73XdK7Vgr36RgbJS7nwHbzFq3/hDYd+UED4BA0Pj4YbdyJoadWYKEjC3613vU+nib/YOXnyImfwxezCAopoRPiMkr3C7yGUeJdwHe3MWh9TZvzEhIFOsJEUWmHF+oZ1c98NZvnY0Cwu/jw1ykjZLlaGEx10FVXMD/Xvi1yvH+2r5ZsFZp4bUyHubw6SHRV6W0OV1Gd00m7fGIDzqypRV2t1V2xsfyzs3Kcg1Wo1jwK2L+Z3KSmsTK7aeA2pLxsDH2oVeaEDyXPbxUl7rJBzPJQD+aBjiArDYomyQmbm3DLbXNl6elwk3MnJZjG2h1N9qpkRkksHpNPmNc3T0XBuLgttk9wFRIY6RkHTkNtNzBHHiclk0/roEg/g=----ATTACHMENT:----OTc4MDc0MjAxMTM5NzI2IDMzMzA0ODk1MDY4OTYzNDUgNTE1MTA1MzExNzQ3MDIyNQ==