Commit d7b20977 by Jacob Morrison

Simplify apidoc to allow for custom renderers via ext

parent b85142a4
...@@ -103,15 +103,11 @@ class RenderController extends Controller ...@@ -103,15 +103,11 @@ class RenderController extends Controller
*/ */
protected function findRenderer() protected function findRenderer()
{ {
$file = Yii::getAlias('@yii/apidoc/templates/' . $this->template . '/Renderer.php'); $rendererClass = 'yii\\apidoc\\templates\\' . $this->template . '\\Renderer';
$reflection = new FileReflector($file, true); if (!class_exists($rendererClass)) {
$reflection->process();
$classes = $reflection->getClasses();
if (empty($classes)) {
$this->stderr('Renderer not found.' . PHP_EOL); $this->stderr('Renderer not found.' . PHP_EOL);
exit(0);
} }
$rendererClass = reset($classes)->getName();
require($file);
return new $rendererClass(); return new $rendererClass();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment