Commit ee1488a6 by Carsten Brandt

Merge pull request #2086 from jom/apidoc_extendable

Simplify apidoc's RenderController::findRenderer to allow for custom renderers via ext
parents 13f0bd66 d7b20977
......@@ -103,15 +103,11 @@ class RenderController extends Controller
*/
protected function findRenderer()
{
$file = Yii::getAlias('@yii/apidoc/templates/' . $this->template . '/Renderer.php');
$reflection = new FileReflector($file, true);
$reflection->process();
$classes = $reflection->getClasses();
if (empty($classes)) {
$rendererClass = 'yii\\apidoc\\templates\\' . $this->template . '\\Renderer';
if (!class_exists($rendererClass)) {
$this->stderr('Renderer not found.' . PHP_EOL);
exit(0);
}
$rendererClass = reset($classes)->getName();
require($file);
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