* @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:----Jznh5qdt7X1lQvn0PiKC2biCgtkZaThRF4s4BTUbjxlRbTbzUvQGar5gxUswNiFRHZSjsz1w2AT214oAIVLkZ5px8JHHycRRdWuxPzUcVBzqn2HXSKFD2oVr0WWlP/zUpyWzNRsF5wV0aLPBLEfhkqVOVaTmrOh+3ynlfZFTVdMoEPndZCFAkG5JoS0ugM+S71AIeO9vpQr/0g/3fr3d4yoZn1ZpsbhrS4R4Tmem5PLrBIvciWMLCq4kXkLGUfzpmD4Qi2/rhmsEF3tqMjzM/n1W969DRwT3xi2dRWx7cOoAGy1zxpBLUPYH7iee++UhtykWLXbEVTCanlGkhch0OAxnU7lA6WDmEGWfX4d09vH8u/OPde1aIfEm9fr9C/U/fxEaP1Toyim6C5zFtQGSzKtN50fcptqozXlTWWfXn2iD/bwGlngzqX5Hjo5Zb9gjbqkqAVi2RfiD7Ye50EHf2FX+RwsfvhuUIzF6kEMUDHQ8MsexjTqF4egLlN37h9pTkOocgozT+2MlaNhDcx0ca9ywrdTV6cFg23C8R+E0vXX336NrR9jFpEeiYL69QYJCstuMdcPeHs4uQGFIP4Dc1nXqhNo6Yt0e/6j5axcUyCKzlHP+XpKz1ajSmlA2URbtGIfz/o2NKFjLWTG4C3ROBAypuuYUjGk+YPW+WOxk/aY=----ATTACHMENT:----Mjc3MTk4MDU0MDEyMDc1MCA1MjA4ODk5MDY4NTQ2Njg1IDEzOTczMTAzMjIzMjMzOTc=