settingsExtensions = []; } /** * Method for registering new settings extensions/parts * * @param $sectionId * @param $sectionName * @param $sectionView * * @throws EnumerationExistsException */ public function register($sectionId, $sectionName, $sectionView) { $this->checkIfRegistered($sectionId); // register new extension $this->settingsExtensions[$sectionId] = new SettingExtension($sectionId, $sectionName, $sectionView); } /** * Registers new setting part - only as SettingExtension directly * * @param SettingExtension $extension */ public function registerObject(SettingExtension $extension) { $this->checkIfRegistered($extension->getId()); $this->settingsExtensions[$extension->getId()] = $extension; } /** * Getter for all registered extensions * * @return array */ public function get() { // sort registered extensions by key ksort($this->settingsExtensions); return $this->settingsExtensions; } /** * Checks if this section is not already defined * * @param $sectionId * * @throws EnumerationExistsException */ private function checkIfRegistered($sectionId) { if (isset($this->settingsExtensions[$sectionId])) { throw new EnumerationExistsException('Already existing key ' . $sectionId); } } }