izzum\statemachine\State::setExitCallable PHP Method

setExitCallable() public method

set the exit callable, the callable to be called when exiting this state
public setExitCallable ( callable $callable )
$callable callable
    public function setExitCallable($callable)
    {
        $this->callable_exit = $callable;
        return $this;
    }

Usage Example

 /**
  * @test
  */
 public function shouldFailEntryAndExitWithNonCallable()
 {
     $state = new State('a');
     $context = new Context(new Identifier('123', 'foo-machine'));
     $event = 'foo';
     $callable = "Foo::BarEntry";
     $state->setEntryCallable($callable);
     $callable = "Foo::BarExit";
     $state->setExitCallable($callable);
     try {
         $state->entryAction($context);
         $this->fail('should not come here');
     } catch (Exception $e) {
         $this->assertEquals(Exception::CALLABLE_FAILURE, $e->getCode());
     }
     try {
         $state->exitAction($context);
         $this->fail('should not come here');
     } catch (Exception $e) {
         $this->assertEquals(Exception::CALLABLE_FAILURE, $e->getCode());
     }
 }
All Usage Examples Of izzum\statemachine\State::setExitCallable