Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
- Remove middleware reference from Gitea Traefik labels (caused routing issues) - Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s) - Add explicit service reference in Traefik labels - Fix intermittent 504 timeouts by improving PostgreSQL connection handling Fixes Gitea unreachability via git.michaelschiemer.de
138 lines
3.8 KiB
PHP
138 lines
3.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Application\Admin\ValueObjects;
|
|
|
|
use App\Framework\Icon\Icon;
|
|
|
|
final readonly class AdminPageMetadata
|
|
{
|
|
public function __construct(
|
|
public string $path,
|
|
public string $title,
|
|
public string $routeName,
|
|
public string $controllerClass,
|
|
public string $methodName,
|
|
public Icon|string|null $icon = null,
|
|
public ?string $section = null,
|
|
public int $order = 0,
|
|
public bool $hidden = false,
|
|
public ?string $description = null
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Get icon as Icon object
|
|
*/
|
|
public function getIcon(): ?Icon
|
|
{
|
|
if ($this->icon === null) {
|
|
return null;
|
|
}
|
|
|
|
if ($this->icon instanceof Icon) {
|
|
return $this->icon;
|
|
}
|
|
|
|
return Icon::fromString($this->icon);
|
|
}
|
|
|
|
public static function fromArray(array $data): self
|
|
{
|
|
return new self(
|
|
path: $data['path'],
|
|
title: $data['title'],
|
|
routeName: $data['route_name'] ?? '',
|
|
controllerClass: $data['controller_class'],
|
|
methodName: $data['method_name'],
|
|
icon: $data['icon'] ?? null, // Can be string or Icon
|
|
section: $data['section'] ?? null,
|
|
order: $data['order'] ?? 0,
|
|
hidden: $data['hidden'] ?? false,
|
|
description: $data['description'] ?? null
|
|
);
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'path' => $this->path,
|
|
'title' => $this->title,
|
|
'route_name' => $this->routeName,
|
|
'controller_class' => $this->controllerClass,
|
|
'method_name' => $this->methodName,
|
|
'icon' => $this->icon instanceof Icon ? $this->icon->toString() : $this->icon,
|
|
'section' => $this->section,
|
|
'order' => $this->order,
|
|
'hidden' => $this->hidden,
|
|
'description' => $this->description,
|
|
];
|
|
}
|
|
|
|
public function withTitle(string $title): self
|
|
{
|
|
return new self(
|
|
path: $this->path,
|
|
title: $title,
|
|
routeName: $this->routeName,
|
|
controllerClass: $this->controllerClass,
|
|
methodName: $this->methodName,
|
|
icon: $this->icon,
|
|
section: $this->section,
|
|
order: $this->order,
|
|
hidden: $this->hidden,
|
|
description: $this->description
|
|
);
|
|
}
|
|
|
|
public function withSection(?string $section): self
|
|
{
|
|
return new self(
|
|
path: $this->path,
|
|
title: $this->title,
|
|
routeName: $this->routeName,
|
|
controllerClass: $this->controllerClass,
|
|
methodName: $this->methodName,
|
|
icon: $this->icon,
|
|
section: $section,
|
|
order: $this->order,
|
|
hidden: $this->hidden,
|
|
description: $this->description
|
|
);
|
|
}
|
|
|
|
public function withOrder(int $order): self
|
|
{
|
|
return new self(
|
|
path: $this->path,
|
|
title: $this->title,
|
|
routeName: $this->routeName,
|
|
controllerClass: $this->controllerClass,
|
|
methodName: $this->methodName,
|
|
icon: $this->icon,
|
|
section: $this->section,
|
|
order: $order,
|
|
hidden: $this->hidden,
|
|
description: $this->description
|
|
);
|
|
}
|
|
|
|
public function withHidden(bool $hidden): self
|
|
{
|
|
return new self(
|
|
path: $this->path,
|
|
title: $this->title,
|
|
routeName: $this->routeName,
|
|
controllerClass: $this->controllerClass,
|
|
methodName: $this->methodName,
|
|
icon: $this->icon,
|
|
section: $this->section,
|
|
order: $this->order,
|
|
hidden: $hidden,
|
|
description: $this->description
|
|
);
|
|
}
|
|
}
|
|
|