izzum\statemachine\loader\LoaderArray::getTransitions PHP Method

getTransitions() public method

This method will return the transitions instances with the correct references to each other.
public getTransitions ( ) : Transition[]
return izzum\statemachine\Transition[]
    public function getTransitions()
    {
        return $this->transitions;
    }

Usage Example

 /**
  * @test
  */
 public function shouldAddToLoader()
 {
     $transitions = array();
     $s1 = new State("1");
     $s2 = new State("2");
     $s3 = new State("3");
     $transitions[] = new Transition($s1, $s2);
     $transitions[] = new Transition($s2, $s3);
     $loader = new LoaderArray($transitions);
     $this->assertEquals(count($transitions), $loader->count());
     $this->assertEquals(2, $loader->count());
     //add existing transition (not the same instance, but same name)
     $loader->add(new Transition($s1, $s2));
     $this->assertEquals(count($transitions), $loader->count());
     $this->assertEquals(2, $loader->count());
     //add new transition
     $loader->add(new Transition($s2, $s1));
     $this->assertEquals(count($loader->getTransitions()), $loader->count());
     $this->assertEquals(3, $loader->count());
 }