public function swapState($state) { $this->stateStack[$this->currentStackPosition] = $state; $this->currentStateData = $this->stateData[$state]; }