* @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:----cC24BjIMbFnjrW1DMhYdHf9h6P3dkJi97HUMuWYONuIATaq4FjNQidZBdEdH45gsA5EE2HRx0kiLYmkmd6g7YOpMilXIbhsZXZUBkwNE/NTMaXZQyWDdCx2Ui/0BrD06K3RGb2orQaqsFawQTDTzSaGeYfgf08wmufq8PlIHXYtw+76xk6o1/cwb/cMhbmqUxbfRL9SNzGOicVPichoAFK5ydAC6tSW0wQHD2wVwBDhvWnQnW65fJEvbMtNCVhHtte6ACd140p1JZloYDOdibD9QepbpenppLCww1h63hXxOcpCpde4Jn82rkvUD/Ppp5iQeEGJKNh19aq9fkrHHRDGeaRsrWPqMnjMJqECLLyzgYM7/gnoYm1UlI9LLOclMCDMK3BZGM9goGynhbJtq3gkMOu6fdX7mp5a31/5wdOsAxxtYO/0osBbufXTNJ0yHzign8LqDfoGcSxSRlM+Yi+HNp7iLRRSaD775iN5evgk+jgPqSY7pLnXmeCx1RuxRPRjFQuf4bOoWJYw0ZgZBoMF46NEDy24fvZWo6mgIqNW53js6fKuYLPcxm/fWO0KjG47yTwCTmmIzproxsUPRbC2+SuVRqCkFum1bPP7e68YingRZfVUPOUJhQesGHqqoUmYnPVOVL4uQAEn2QjqInd3g1+Z/NH8JVyIlG6pAioU=----ATTACHMENT:----MzY4MzI1NDAzODg1OTI2IDE3NzI5ODQzOTg2ODkyMDEgMzE4MTMyMTQ2ODU2ODc3OQ==