'object', 'properties' => [ 'id' => ['type' => 'integer', 'readonly' => true], 'program_id' => ['type' => 'integer', 'required' => true], 'key_value' => ['type' => 'string', 'required' => true, 'minLength' => 1], ], ]; } public static function from_array(array $data): self { return new self( intval($data['id'] ?? null), intval($data['program_id'] ?? 0), $data['key_value'] ?? '' ); } public function __construct(?int $id, int $program_id, string $key_value) { $this->id = $id; $this->program_id = $program_id; $this->key_value = $key_value; } public function to_array() { return [ 'id' => $this->id, 'program_id' => $this->program_id, 'key_value' => $this->key_value, ]; } }