mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-20 02:22:28 +08:00
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Values\WpOrg\Themes;
|
|
|
|
use App\Models\WpOrg\Theme;
|
|
use App\Values\DTO;
|
|
use Illuminate\Support\Collection;
|
|
|
|
readonly class ThemeUpdateCheckResponse extends DTO
|
|
{
|
|
/**
|
|
* @param Collection<string, ThemeUpdateData> $themes
|
|
* @param Collection<string, ThemeUpdateData> $no_update
|
|
* @param Collection<array-key, mixed> $translations
|
|
*/
|
|
public function __construct(
|
|
public Collection $themes,
|
|
public Collection $no_update,
|
|
public Collection $translations,
|
|
) {}
|
|
|
|
/**
|
|
* @param iterable<array-key, Theme> $themes
|
|
* @param iterable<array-key, Theme> $no_update
|
|
*/
|
|
public static function fromResults(iterable $themes, iterable $no_update): self
|
|
{
|
|
$mkUpdates = fn(iterable $items) => ThemeUpdateData::collect($items)->keyBy('theme');
|
|
|
|
return new self(
|
|
themes: $mkUpdates($themes), // @mago-expect analysis:less-specific-argument
|
|
no_update: $mkUpdates($no_update), // @mago-expect analysis:less-specific-argument
|
|
translations: collect(), // TODO
|
|
);
|
|
}
|
|
}
|