public function saveState() { $index = $this->getActiveStepIndex(); $history = $this->getHistory(); if (!$history->getCount() || $history->peek() !== $index) { $history->push($index); } }