private function call_endpoint($class, $method) { $c = new $class(); $method_c = substr($method, -1) == '0' ? substr($method, 0, -1) : $method; if (!$this->validate_method($class, $method_c)) { echo JsonServer::Encode($this->error(JsonServer::INVALID_HTTP_REQUEST_METHOD, "Method {$method} requires a different HTTP Request Method (2); ")); return; } if (method_exists($c, $method_c)) { ob_start(); $output = $this->run_call($class, $method_c, $this->wrangle_parameters($this->get_call_definition($class, $method), substr($method, -1) == '0')); $trace = ob_get_contents(); ob_end_clean(); switch ($this->TRACE) { case JsonServer::TRACE_OFF: unset($output['Trace']); break; case JsonServer::TRACE_ON: $output['Trace'] = $trace; break; default: if (!$output['Status']) { $output['Trace'] = $trace; } else { unset($output['Trace']); } break; } echo JsonServer::Encode($output); return; } else { echo JsonServer::Encode($this->error(JsonServer::NO_CLASS, "Class {$class} or method {$method} does not exist; ")); return; } }