/** * Return the current page of this wizard * * @return Form * * @throws LogicException In case the name of the current page currently being set is invalid */ public function getCurrentPage() { if ($this->parent) { return $this->parent->getCurrentPage(); } if ($this->currentPage === null) { $this->assertHasPages(); $pages = $this->getPages(); $this->currentPage = $this->getSession()->get('current_page', $pages[0]->getName()); } if (($page = $this->getPage($this->currentPage)) === null) { throw new LogicException(sprintf('No page found with name "%s"', $this->currentPage)); } return $page; }