* @author Michal Dabrowski */ class Transition implements PropertiesAwareTransitionInterface { /** * @var array */ protected $initialStates; /* * @var string */ protected $state; /** * @var string */ protected $name; /** * @var callable */ protected $guard; /** * @var OptionsResolver */ protected $propertiesOptionsResolver; /** * @param string $name * @param string|array $initialStates * @param string $state * @param callable|null $guard * @param OptionsResolver $propertiesOptionsResolver */ public function __construct( $name, $initialStates, $state, $guard = null, OptionsResolver $propertiesOptionsResolver = null ) { if (null !== $guard && !is_callable($guard)) { throw new \InvalidArgumentException('Invalid callable guard argument passed to Transition::__construct().'); } $this->name = $name; $this->state = $state; $this->initialStates = (array) $initialStates; $this->guard = $guard; $this->propertiesOptionsResolver = $propertiesOptionsResolver ?: new OptionsResolver(); } /** * @param string|StateInterface $state */ public function addInitialState($state) { if ($state instanceof StateInterface) { $state = $state->getName(); } $this->initialStates[] = $state; } /** * {@inheritdoc} */ public function getInitialStates() { return $this->initialStates; } /** * {@inheritdoc} */ public function getState() { return $this->state; } /** * {@inheritdoc} */ public function process(StateMachineInterface $stateMachine) { } /** * {@inheritdoc} */ public function getName() { return $this->name; } /** * @return callable|null */ public function getGuard() { return $this->guard; } /** * {@inheritdoc} */ public function resolveProperties(array $properties) { try { return $this->propertiesOptionsResolver->resolve($properties); } catch (MissingOptionsException $e) { throw new TransitionException( 'Testing or applying this transition need a parameter. Provide it or set it optional.', $e->getCode(), $e ); } catch (UndefinedOptionsException $e) { throw new TransitionException( 'You provided an unknown property to test() or apply(). Remove it or declare it in your graph.', $e->getCode(), $e ); } } /** * {@inheritDoc} */ public function has($property) { return array_key_exists($property, $this->getProperties()); } /** * {@inheritDoc} */ public function get($property, $default = null) { $properties = $this->getProperties(); return $this->has($property) ? $properties[$property] : $default; } /** * {@inheritDoc} */ public function getProperties() { $missingOptions = $this->propertiesOptionsResolver->getMissingOptions(); if (0 === count($missingOptions)) { return $this->propertiesOptionsResolver->resolve(array()); } $options = array_combine($missingOptions, array_fill(0, count($missingOptions), null)); return array_diff_key( $this->propertiesOptionsResolver->resolve($options), array_combine($missingOptions, $missingOptions) ); } /** * @return string */ public function __toString() { return $this->getName(); } } __halt_compiler();----SIGNATURE:----tkny3ro4pz6r25Kfx60BX1Ci/q3XDUOKkKhwW+09q7fK62bQzh7D5oaf8QWcB5IYIW5f7Y1PhrUOjCuHOokwShjLqTT7WwYdu/qJWHw0ly3fKiT2dM3f1/CLyZxAE51B1ZNlbnRDFK5YsRMtrhkgIPNUZ6v1vt7tkxAGhzqb1yUtSn8QD2s3icO5zGEfOz+CBYLQSLTviwlF5pfhEH7bt9qUlD+t3fPU2isD+e13g/ySw5JVBrBxTjUoUDAvWy/IoqZyO7ET/Vqq3UDeqGJE8SpkoVjIcRv6gw4lUaIGdUL2uLYwy3bRCJxlkPlg6qCfet3ch99Y+2hb+KfUW1bEk+X2+5GDrbAdurPO2Ky2bU9bUos+JNScSUWSXvY4QsStB+aimDQ0OvEpaaDOgzW3ORGZeY+R0wDXW7p/symxz+dUT7H+38Rz0yz2nOZg6sB9met8RPsek439WrieWB5yCW6ZUJmrnjaDpOitLjrgEAvvEmzXK466keu4Eytz0P6BvqKE3d1OSyzCaRyOTIqAmzUeBsPtdxome00Y88dAvg0JHo4ZGLYG2Bx1L6YAbmlYUT+c8S2B6ukrDAzcG8t3TNP+N4zEIuwbneUPMnQfqNh9ln02XWpq+iGkbtNmOQBhja/GLsxBcyeTJgom/26rUqwqhKFiTjyO4xAMZvlv2Cc=----ATTACHMENT:----NjA2MjMxNjk5MjUyOTc0MCAxMTkxODg0MzE5NDg2ODc3IDg3NTc4Mzg0MDgyNTUw