GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — xmlvalid-php/src/Model/Event.php at main · xmlvalid/xmlvalid-php Expand file tree/ Copy pathEvent.phpMore file actions 50 lines (40 loc) · 1.34 KB / Copy pathEvent.phpFile metadata and controls50 lines (40 loc) · 1.34 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 <?php declare(strict_types=1); namespace Xmlvalid\Model; use DateTimeImmutable; /** * A webhook event: validation.completed, monitor.failed, monitor.recovered * or ping. A retry carries the same id, so it can be used to skip events * already handled. */ final class Event { public const VALIDATION_COMPLETED = 'validation.completed'; public const MONITOR_FAILED = 'monitor.failed'; public const MONITOR_RECOVERED = 'monitor.recovered'; public const PING = 'ping'; /** * @param array<string, mixed> $data */ public function __construct( public readonly string $id, public readonly string $type, public readonly ?DateTimeImmutable $createdAt, public readonly array $data, ) {} /** @param array<string, mixed> $payload */ public static function fromArray(array $payload): self { return new self( id: Data::string($payload, 'id'), type: Data::string($payload, 'type'), createdAt: Data::date($payload, 'created_at'), data: Data::object($payload, 'data') ?? [], ); } /** The validation of a validation.completed event; null for other events. */ public function validation(): ?Validation { return $this->type === self::VALIDATION_COMPLETED ? Validation::fromArray($this->data) : null; } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |