Initial import

This commit is contained in:
2026-06-04 11:13:34 +01:00
commit 563d9cc96d
143 changed files with 10572 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
class GeminiParameter {
public $name;
public $type;
public $description;
public $required;
public $children;
public $enum;
public function __construct($n, $t, $d, $r = false) {
$this->name = $n;
$this->type = $t;
$this->description = $d;
$this->required = $r;
$this->children = [];
$this->enum = [];
}
public function add_enum($e) {
$this->enum[] = $e;
}
public function add_child($n, $t, $d, $r = false) {
$p = new GeminiParameter($n, $t, $d, $r);
$this->children[$n] = $p;
return $p;
}
public function get_object() {
$o = new stdClass;
$o->type = $this->type;
$o->description = $this->description;
switch ($this->type) {
case "string":
if (count($this->enum) > 0) {
$o->format = "enum";
$o->enum = $this->enum;
}
break;
case "object":
$o->properties = [];
$o->required = [];
foreach ($this->children as $cn=>$c) {
$o->properties[$cn] = $c->get_object();
if ($c->required) {
$o->required[] = $cn;
}
}
break;
}
return $o;
}
}