Skip to content

Commit 41a5a68

Browse files
tom--cebe
authored andcommitted
output everything to a JSON text
close #13
1 parent 85678e8 commit 41a5a68

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

templates/json/ApiRenderer.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/**
3+
* @link http://www.yiiframework.com/
4+
* @copyright Copyright (c) 2008 Yii Software LLC
5+
* @license http://www.yiiframework.com/license/
6+
*/
7+
8+
namespace yii\apidoc\templates\json;
9+
10+
use yii\apidoc\models\Context;
11+
use yii\apidoc\renderers\ApiRenderer as BaseApiRenderer;
12+
use yii\base\ViewContextInterface;
13+
use Yii;
14+
15+
/**
16+
* The class for outputting documentation data structures as a JSON text.
17+
*
18+
* @author Tom Worster <[email protected]>
19+
* @since 2.0.5
20+
*/
21+
class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
22+
{
23+
24+
/**
25+
* Writes a given [[Context]] as JSON text to file 'types.json'.
26+
*
27+
* @param Context $context the api documentation context to render.
28+
* @param $targetDir
29+
*/
30+
public function render($context, $targetDir)
31+
{
32+
$types = array_merge($context->classes, $context->interfaces, $context->traits);
33+
file_put_contents($targetDir . '/types.json', json_encode($types, JSON_PRETTY_PRINT));
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function generateApiUrl($typeName)
40+
{
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
protected function generateFileName($typeName)
47+
{
48+
}
49+
50+
/**
51+
* @inheritdoc
52+
*/
53+
public function getViewPath()
54+
{
55+
}
56+
57+
/**
58+
* @inheritdoc
59+
*/
60+
protected function generateLink($text, $href, $options = [])
61+
{
62+
}
63+
64+
/**
65+
* @inheritdoc
66+
*/
67+
public function getSourceUrl($type, $line = null)
68+
{
69+
}
70+
}

0 commit comments

Comments
 (0)