/** * Stores the result code from the latest API Request, so developers can * always access the latest result in $bb->result, or $bb->result(), or $bb->result_friendly etc * * @param object $result A reference to the API's response * @param string $svc Service name called * @param array $args Arguments used * @return void */ private function set_result(&$result, $svc, $args) { //Stash the new values, and try to translate the result code to be more readable $this->last_result = isset($result->result) ? $result->result : false; $this->last_friendly_result = BBHelper::translate_result($this->last_result); //Parse into an object for storage / dumping $result_history = (object) array('result' => $this->last_result, 'friendly' => $this->last_friendly_result, 'svc' => $svc, 'args' => $args); //Store it in the result history array too $this->result_history[] = $result_history; //Dump failed calls if ($this->last_result != 200) { $title = 'API Failure (' . $this->last_friendly_result . ')'; BBDev::print_error($this, $this->last_result, $title, debug_backtrace()); } }