* } */ readonly class StructureNode { /** * @param list $children */ public function __construct( public string $role, public int $position, public ?int $compositionVersionId, public ?int $compositionId, public ?int $contentElementVersionId, public ?int $contentElementId, public ?string $editorialKindLabel, public ?string $technicalKindLabel, public ?string $outputClass, public string $title, public array $children = [], ) {} /** * @return array */ public function toArray(): array { return [ 'role' => $this->role, 'position' => $this->position, 'composition_version_id' => $this->compositionVersionId, 'composition_id' => $this->compositionId, 'content_element_version_id' => $this->contentElementVersionId, 'content_element_id' => $this->contentElementId, 'editorial_kind' => $this->editorialKindLabel, 'technical_kind' => $this->technicalKindLabel, 'output_class' => $this->outputClass, 'title' => $this->title, 'children' => array_map(fn (StructureNode $child): array => $child->toArray(), $this->children), ]; } }