mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-20 02:22:28 +08:00
26 lines
755 B
PHP
26 lines
755 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Values\WpOrg\Plugins;
|
|
|
|
use App\Values\DTO;
|
|
use Bag\Attributes\StripExtraParameters;
|
|
use Bag\Attributes\Transforms;
|
|
use Illuminate\Http\Request;
|
|
|
|
// Far simpler than ThemeInformationRequest, it takes a slug and that's it
|
|
#[StripExtraParameters]
|
|
readonly class PluginInformationRequest extends DTO
|
|
{
|
|
public const ACTION = 'plugin_information';
|
|
|
|
public function __construct(public string $slug) {}
|
|
|
|
/** @return array<string, mixed> */
|
|
#[Transforms(Request::class)]
|
|
public static function fromRequest(Request $request): array
|
|
{
|
|
// Bag throws 500 (RuntimeException) for missing fields, this throws a friendlier 422
|
|
return $request->validate(['slug' => 'required']);
|
|
}
|
|
}
|