*/ private $sections = []; /** * Adds a section to the list. * * @param Section $section A section. * * @return void */ public function add( Section $section ): void { $this->sections[] = $section; } /** * Returns this object in array format. * * @return array|null>>> The sections as an array. */ public function to_array(): array { $result = []; foreach ( $this->sections as $section ) { $result[] = $section->to_array(); } return [ 'outline' => $result ]; } }