locator = $locator; $this->pages = $pages; } public function getTypes() { return array_keys($this->pages); } /** * @return PageInterface * * @throws UnknownPageTypeException */ public function getPageService(string $type) { if (isset($this->pages[$type])) { $class = $this->pages[$type]['class']; if ($this->locator->has($class)) { return $this->locator->get($class); } } throw new UnknownPageTypeException($type); } }