Files
laraundfelix/app/Domain/Catalog/StructureNode.php
T
LarsandCursor 338739a882
Deploy Test / test (push) Successful in 15s
Deploy Test / deploy (push) Successful in 26s
Formatiere Paket-1-bis-3-Code fuer die CI-Pruefung
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-16 07:58:29 +01:00

59 lines
1.8 KiB
PHP

<?php
namespace App\Domain\Catalog;
/**
* @phpstan-type StructureNodeData array{
* role: string,
* position: int,
* composition_version_id: int|null,
* composition_id: int|null,
* content_element_version_id: int|null,
* content_element_id: int|null,
* editorial_kind: string|null,
* technical_kind: string|null,
* title: string,
* output_class: string|null,
* children: list<StructureNodeData>
* }
*/
readonly class StructureNode
{
/**
* @param list<StructureNode> $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<string, mixed>
*/
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),
];
}
}