componentRegistrar = $componentRegistrar; $this->factory = $factory; } /** * Get theme by path key * * @param string $key * @return ThemePackage * @throws \UnexpectedValueException */ public function getTheme($key) { $themePath = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $key); if (empty($themePath)) { throw new \UnexpectedValueException("No theme registered with name '$key'"); } return $this->factory->create($key, $themePath); } /** * Get all themes * * @return ThemePackage[] */ public function getThemes() { $themes = []; foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::THEME) as $key => $path) { $themes[$key] = $this->factory->create($key, $path); } return $themes; } }