/** * Execute the command. Will call initializeForCommand() which should set the version, error and response * values appropriately */ public function executeCommand() { if (empty($this->command)) { throw new KurogoException("Command not specified"); } $this->loadResponseIfNeeded(); if ($this->clientBrowser == 'native') { if ($appData = Kurogo::getAppData($this->clientPlatform)) { if ($minversion = Kurogo::arrayVal($appData, 'minversion')) { if (version_compare($this->clientVersion, $minversion) < 0) { $data = array('url' => Kurogo::arrayVal($appData, 'url'), 'version' => Kurogo::arrayVal($appData, 'version')); $error = new KurogoError(7, 'Upgrade Required', 'You must upgrade your application'); $error->setData($data); $this->throwError($error); } } } } $this->initializeForCommand(); $json = $this->response->getJSONOutput(); $size = strlen($json); if ($this->logView) { $this->logCommand($size); } header("Content-Length: " . $size); header("Content-Type: application/json; charset=utf-8"); echo $json; exit; }