public function stepIndex($stepId) { $steps = $this->steps(); $i = 0; foreach ($steps as $id => $step) { if ($id == $stepId) { return $i; } ++$i; } throw new StepNotFoundException(); }