*/ private $sections = array(); /** * Register (or replace) a section. * * @param Settings_Section_Interface $section The section. */ public function register( Settings_Section_Interface $section ): void { $this->sections[ $section->id() ] = $section; } /** * Get a section by id. * * @param string $id Section id. * * @return Settings_Section_Interface|null */ public function get( string $id ): ?Settings_Section_Interface { return $this->sections[ $id ] ?? null; } /** * Whether a section is registered. * * @param string $id Section id. * * @return bool */ public function has( string $id ): bool { return isset( $this->sections[ $id ] ); } /** * All registered sections, keyed by id. * * @return array */ public function all(): array { return $this->sections; } }