initial
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class RsvTimetable {
|
||||
public int|null $id;
|
||||
public string $name;
|
||||
public int $block_size;
|
||||
public ?string $google_calendar_id;
|
||||
public ?string $maintainer_email;
|
||||
|
||||
public static function schema(): array {
|
||||
return [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => ['type' => 'integer', 'readonly' => true],
|
||||
'name' => ['type' => 'string', 'required' => true, 'minLength' => 1],
|
||||
'block_size' => ['type' => 'integer', 'required' => true, 'minimum' => 1],
|
||||
'maintainer_email' => ['type' => ['string', 'null'], 'format' => 'email'],
|
||||
'google_calendar_id' => ['type' => ['string', 'null']],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function __construct(array $data) {
|
||||
$this->id = $data['id'] ?? null;
|
||||
$this->name = $data['name'];
|
||||
$this->block_size = $data['block_size'] ?? 0;
|
||||
$this->google_calendar_id = $data['google_calendar_id'] ?? null;
|
||||
$this->maintainer_email = $data['maintainer_email'] ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user