* @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:----Mrj43uMXOKDxsApoRyqIp/MPWjSJGISFqNrQKf5DPWfGSioPqs+3o8v4fk2jv2CCXrkbaPs+BKDZPE7B5UHe//sgqXfL/WUHFnHSUbGKC/UbHno5pZdCa0rrQICEj/+DhLlZgE+If9XHMVkocjkma/CibkcRck0Fv8hxC9oHArqkl28zqQcArjwDHL20mNmhNiaZq/cGsI9HowmHOhNvLxAsZTwucTlSqUuDX9ICgs8NCjQWwCMh6YPTq6XV+o3HMO7FdRxV6uwvvu3aVFKwR2O7QxHh2jrc2Te7YYGlIqGZY7QN2wqpz7TTD79P4SNoKvZ3AdCvbLtdYHBPKNOyl3emmrXQbls9A6HpFw9uaek9vl7kb5/gBHZ9g8gtXnbydjXx5i0lx/lC1zwlY05jFBjv7WbrkqhEJ8zmqmi9FcNq7lbhIZll2FR61//B/agTq9zcvUSe4OoKOsdm56ttXeQp9WKO+xyW1EFc70fw4WUDYLxsEe9S28oXxMfAlpDyRjq+7d7A2x9eF3/7ndzoK+Zbunj58RbpgifWuR5jzre0OQYabseXi2eAHMYVcdtsEVz7ipjeENP3hrENhK2JC5sMCeZGf5NXMaQ5YD5Ew/T/HwHgsnUN6a2WIL5kzrEQEXyPuAB30N6/nmopY0+kNPSkIbcQVbY4rEwUc/J9IFk=----ATTACHMENT:----ODQ3MDgwODMwMzgwMTgwNiA3NjI5MTQ5NTg2NzQwODE4IDU2NDY2MzUyNjk5MTE3NDQ=