本文整理汇总了PHP中Profiler::profiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::profiles方法的具体用法?PHP Profiler::profiles怎么用?PHP Profiler::profiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::profiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
private function dispatch()
{
try {
$this->call = self::$req->scheme();
$action = self::$req->action;
// the request action (method)
$obj = $this->call->class;
$method = $this->call->method;
$preflight = $this->call->preflight;
$type = self::$req->type;
$model = null;
$res = $this->call->resource;
// the root resource
presto_lib::_trace('REQUEST', "[{$this->call->file}] {$obj}::{$method} ({$this->call->type})", json_encode($this->call->params), json_encode($this->call->options));
// Create an an instance of the API subclass (autoloaded)
autoload_delegate($this->call);
if (!class_exists($obj)) {
throw new Exception("API class not found for {$obj}::{$method}", 404);
}
// Start the response setup
self::$resp = new response($this->call);
API::attach($this->call, self::$resp, self::$req);
$o = new $obj();
// Verify the request
if ($obj == 'error') {
// disallow root component access
throw new Exception('Root access not allowed', 403);
}
if (!method_exists($obj, $preflight)) {
if (method_exists($obj, 'autoload_model')) {
// try a default model autoloader "preflight"
$model = $o->autoload_model($this->call->params, $this->call->options, self::$req->body(), $this->call->type);
} else {
// skip + trace missing preflight functions (data will be passed as standard HTTP params)
presto_lib::_trace('PREFLIGHT', 'skipped', "[{$this->call->file}] {$obj}::{$preflight} ({$this->call->type})", json_encode($this->call->params), json_encode($this->call->options));
}
} else {
// attempt a custom "preflight" model autoload call
$model = $o->{$preflight}($this->call->params, $this->call->options, self::$req->body(), $this->call->type);
}
if (!method_exists($obj, $method)) {
// valid route?
throw new Exception("Resource {$obj}->{$method} not found.", 404);
}
$this->call->exists = true;
// Perform the actual sub delegation
if (isset($model)) {
$this->call->data = $o->{$method}($model, $this->call->type);
} else {
$this->call->data = $o->{$method}($this->call->params, $this->call->options, self::$req->body(), $this->call->type);
}
// Produce a response for the client
presto_lib::_trace(PRESTO_TRACE_KEY, json_encode(Presto::trace_info()));
$profiles = Profiler::profiles();
// add any process profiling to trace
if (!empty($profiles)) {
presto_lib::_trace(PROFILER_TRACE_KEY, json_encode($profiles));
}
$encode = is_object($this->call->data) || is_array($this->call->data);
return self::$resp->ok($this->call, $encode, $o->status(), $o->headers());
} catch (Exception $e) {
if (self::$resp === null) {
self::$resp = new response();
}
self::$resp->hdr($e->getCode());
throw $e;
}
}