HEX
Server: LiteSpeed
System: Linux cpir1.prohostdns.com 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: pelakir (2976)
PHP: 8.2.31
Disabled: exec, shell_exec, system, passthru, proc_open, proc_close, proc_terminate, proc_get_status, popen, pclose, pcntl_exec
Upload Files
File: //home/pelakir/www/wp-content/plugins/wordpress-seo/src/ai/content-planner/domain/section-list.php
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\AI\Content_Planner\Domain;

/**
 * List of content outline sections.
 */
class Section_List {

	/**
	 * The sections.
	 *
	 * @var array<Section>
	 */
	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<string, array<array<string, string|array<string>|null>>> The sections as an array.
	 */
	public function to_array(): array {
		$result = [];
		foreach ( $this->sections as $section ) {
			$result[] = $section->to_array();
		}

		return [ 'outline' => $result ];
	}
}