SimpleStateStack::getCurrent PHP Method

getCurrent() public method

Accessor for current state.
public getCurrent ( ) : string
return string State.
    public function getCurrent()
    {
        return $this->stack[count($this->stack) - 1];
    }

Usage Example

Example #1
0
 function testStateMoves()
 {
     $stack = new SimpleStateStack("one");
     $stack->enter("two");
     $this->assertEqual($stack->getCurrent(), "two");
     $stack->enter("three");
     $this->assertEqual($stack->getCurrent(), "three");
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), "two");
     $stack->enter("third");
     $this->assertEqual($stack->getCurrent(), "third");
     $this->assertTrue($stack->leave());
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), "one");
 }
All Usage Examples Of SimpleStateStack::getCurrent