Paket 3: Strukturleser und Anzeigefreigabe (G1, G2)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1a2b1298b5
commit
5ed01b9d04
7 files changed
+372
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user