fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled
Some checks failed
Deploy Application / deploy (push) Has been cancelled
This commit is contained in:
@@ -4,21 +4,51 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Application\Admin\ValueObjects;
|
||||
|
||||
use App\Framework\Icon\Icon;
|
||||
|
||||
final readonly class NavigationSection
|
||||
{
|
||||
/** @param array<NavigationItem> $items */
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public array $items,
|
||||
public ?string $icon = null
|
||||
public Icon|string|null $icon = 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
|
||||
{
|
||||
$items = [];
|
||||
foreach ($data['items'] ?? [] as $itemData) {
|
||||
$items[] = NavigationItem::fromArray($itemData);
|
||||
$itemsData = $data['items'] ?? [];
|
||||
|
||||
foreach ($itemsData as $key => $itemData) {
|
||||
// Handle legacy format: ['Item Name' => '/url']
|
||||
if (is_string($itemData)) {
|
||||
$items[] = NavigationItem::fromArray([
|
||||
'name' => is_string($key) ? $key : 'Item',
|
||||
'url' => $itemData,
|
||||
]);
|
||||
} elseif (is_array($itemData)) {
|
||||
// Handle modern format: [['name' => 'Item Name', 'url' => '/url']]
|
||||
$items[] = NavigationItem::fromArray($itemData);
|
||||
}
|
||||
// Skip invalid formats
|
||||
}
|
||||
|
||||
return new self(
|
||||
|
||||
Reference in New Issue
Block a user