SimpleStateStack::enter PHP Method

enter() public method

Adds a state to the stack and sets it to be the current state.
public enter ( string $state )
$state string New state.
    public function enter($state)
    {
        array_push($this->stack, $state);
    }

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::enter