|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\Helpers\MetaFormats\FormatDefinitions; |
| 4 | + |
| 5 | +use App\Helpers\MetaFormats\Attributes\Format; |
| 6 | +use App\Helpers\MetaFormats\MetaFormat; |
| 7 | +use App\Helpers\MetaFormats\Attributes\FPost; |
| 8 | +use App\Helpers\MetaFormats\Attributes\FQuery; |
| 9 | +use App\Helpers\MetaFormats\Validators\VBool; |
| 10 | +use App\Helpers\MetaFormats\Validators\VInt; |
| 11 | +use App\Helpers\MetaFormats\Validators\VMixed; |
| 12 | +use App\Helpers\MetaFormats\Validators\VString; |
| 13 | +use ArrayAccess; |
| 14 | + |
| 15 | +#[Format(UserFilterFormat::class)] |
| 16 | +class UserFilterFormat extends MetaFormat implements ArrayAccess |
| 17 | +{ |
| 18 | + #[FQuery(new VString(), required: false)] |
| 19 | + public ?string $search; |
| 20 | + |
| 21 | + #[FQuery(new VString(), required: false)] |
| 22 | + public ?string $instanceId; |
| 23 | + |
| 24 | + #[FQuery(new VString(), required: false)] |
| 25 | + public ?string $roles; |
| 26 | + |
| 27 | + public function offsetExists(mixed $offset): bool |
| 28 | + { |
| 29 | + return isset($this->$offset); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * Offset to retrieve |
| 34 | + * @param mixed $offset The offset to retrieve. |
| 35 | + * @return mixed Can return all value types. |
| 36 | + */ |
| 37 | + public function offsetGet(mixed $offset): mixed |
| 38 | + { |
| 39 | + return $this->$offset ?? null; |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Offset to set |
| 44 | + * @param mixed $offset The offset to assign the value to. |
| 45 | + * @param mixed $value The value to set. |
| 46 | + */ |
| 47 | + public function offsetSet(mixed $offset, mixed $value): void |
| 48 | + { |
| 49 | + $this->$offset = $value; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Offset to unset |
| 54 | + * @param mixed $offset The offset to unset. |
| 55 | + */ |
| 56 | + public function offsetUnset(mixed $offset): void |
| 57 | + { |
| 58 | + $this->$offset = null; |
| 59 | + } |
| 60 | +} |
0 commit comments