34 lines
668 B
PHP
34 lines
668 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace BattleForge\Http;
|
|
|
|
use BattleForge\Domain\MatchState;
|
|
|
|
/**
|
|
* @phpstan-type MatchIdAndMatch = array{matchId: string, match: MatchState}
|
|
*/
|
|
final readonly class MatchActionResult
|
|
{
|
|
/**
|
|
* @param ?MatchIdAndMatch $matchIdAndMatch
|
|
*/
|
|
public function __construct(
|
|
public ?Response $response,
|
|
public ?array $matchIdAndMatch,
|
|
) {
|
|
}
|
|
|
|
/** @param MatchIdAndMatch $pair */
|
|
public static function ok(array $pair): self
|
|
{
|
|
return new self(null, $pair);
|
|
}
|
|
|
|
public static function reject(Response $response): self
|
|
{
|
|
return new self($response, null);
|
|
}
|
|
}
|