$ea['description'] = Markdown(implode(PHP_EOL, $ea['description'])); return $ea; }, $method['params'])) : array(); } catch (\Exception $e) { include 'pages/404.php'; return; } } else { $method = null; } $parsed = $docs->walkResources(); ksort($parsed); $d = array(); $types = array('general', 'aspects'); foreach ($parsed as $k => $value) { $d[] = array('name' => $k, 'state' => $k == $resource ? 'open' : 'closed', 'info' => call_user_func(function () use($value, $types) { $data = array('construct' => $value['construct']); foreach ($types as $type) { $t = array_values($value[$type]); if ($t) { $data[$type] = array('list' => $t); } } return $data; })); $i++; } $data = array('conf' => $conf, 'page_path' => $this->urlpath, 'title' => $this->title, 'breadcrumb' => mustachify($breadcrumb, 'label', 'uri', 'list'), 'all_docs' => $d ? array('list' => $d) : null, 'api_doc' => Markdown($docs->getApiDoc()), 'method' => $method); $this->template($template, 'top'); echo $this->mustache('api.m', $data, $this->incpath . '/mustache'); $this->template($template, 'bottom');
$props = (array) $e; array_walk($props, function ($v, $k) use(&$ps, $export) { if (!preg_match('/(Exception|\\*)/', $k)) { $ps[$k] = $export($v); } }); if ($ps) { // reformat to use as a partial $extra = array('list' => array('each' => mustachify($ps))); } // collect validation errors if they are set if (is_a($e, 'ValidationException')) { $list = array_map(function ($e) use($export) { return array('each' => array_map(function ($v) use($export) { return array_map($export, $v); }, mustachify((array) $e))); }, $e->getErrors()); $errors = array('list' => $list); } $info = array('type' => get_class($e), 'message' => $e->getMessage() ?: '--no-message--', 'validation_errors' => $errors, 'extra' => $ps ? $extra : null, 'trace' => array_map(function ($t) use($export) { $t['args'] = array_map(function ($arg) use($export) { if (is_object($arg)) { $name = get_class($arg); } else { if (is_array($arg)) { $name = shorten($export($arg)); } else { $name = shorten($arg); } } return array('display' => $name, 'content' => htmlentities(trim(var_export($arg, true))));