public function process() { switch ($this->request['command']) { case "ping": return "EasyInterface server is alive and kicking!"; break; case "app_info": if (!array_key_exists('app_id', $this->request)) { throw new Exception("Missing app_id"); } return EIApps::get_app_info($this->request['app_id']); case "app_parameters": if (!array_key_exists('app_id', $this->request)) { throw new Exception("Missing app_id"); } return EIApps::get_app_parameters($this->request['app_id']); case "app_details": if (!array_key_exists('app_id', $this->request)) { throw new Exception("Missing app_id"); } return EIApps::get_app_details($this->request['app_id']); case "exset_details": if (!array_key_exists('exset_id', $this->request)) { throw new Exception("Missing exset_id"); } return EIExamples::get_exset_details($this->request['exset_id']); case "execute": if (!array_key_exists('app_id', $this->request)) { throw new Exception("Missing app_id"); } if (!array_key_exists('parameters', $this->request)) { throw new Exception("Missing parameters"); } return EIApps::execute($this->request['app_id'], $this->request['parameters']); case "get_stream": if (!array_key_exists('exec_id', $this->request)) { throw new Exception("Missing exec_id"); } return EIStream::get($this->request['exec_id']); case "kill_stream": if (!array_key_exists('exec_id', $this->request)) { throw new Exception("Missing exec_id"); } return EIStream::kill($this->request['exec_id']); default: throw new Exception("Invalid command in EI request"); } }