_request['rquest'] ?? ''))); if ($func !== '' && method_exists($this, $func)) { $this->$func(); } else { $this->response('{"error":"Not found"}', 404); } } private function hello(): void { $this->response(json_encode(['message' => 'Hello from Crop Monitor API']), 200); } private function test(): void { if ($this->get_request_method() !== 'GET') { $this->response('', 406); return; } $param = $this->_request['var'] ?? ''; $this->response(json_encode(['param' => $param]), 200); } } $api = new API(); $api->processApi();