aspirecloud/app/Values/WpOrg/Themes/ThemeUpdateData.php
2025-10-25 13:15:51 -06:00

36 lines
942 B
PHP

<?php
declare(strict_types=1);
namespace App\Values\WpOrg\Themes;
use App\Models\WpOrg\Theme;
use App\Values\DTO;
use Bag\Attributes\Transforms;
readonly class ThemeUpdateData extends DTO
{
public function __construct(
public string $name,
public string $theme,
public string $new_version,
public string $url,
public string $package,
public ?string $requires,
public ?string $requires_php,
) {}
/** @return array<string, mixed> */
#[Transforms(Theme::class)]
public static function fromTheme(Theme $theme): array
{
return [
'name' => $theme->name,
'theme' => $theme->slug,
'new_version' => $theme->version,
'url' => $theme->download_link,
'package' => $theme->download_link,
'requires' => $theme->requires,
'requires_php' => $theme->requires_php,
];
}
}