File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Yii Framework 2 apidoc extension Change Log
8
8
- Enh #38 : Fixed display of default values given as octal or hex notation (hiqsol)
9
9
- Enh: Display TOC only if there is more than one headline (cebe)
10
10
- Enh: Extracted markdown code highlighting to a trait ` MarkdownHighlightTrait ` (cebe)
11
+ - Enh: Added "type" attribute to JSON renderer to keep information about whether an entry is a class, interface or trait (cebe)
11
12
12
13
13
14
2.1.0 November 22, 2016
Original file line number Diff line number Diff line change 7
7
8
8
namespace yii \apidoc \templates \json ;
9
9
10
+ use yii \apidoc \models \ClassDoc ;
10
11
use yii \apidoc \models \Context ;
12
+ use yii \apidoc \models \InterfaceDoc ;
13
+ use yii \apidoc \models \TraitDoc ;
11
14
use yii \apidoc \renderers \ApiRenderer as BaseApiRenderer ;
12
15
use yii \base \ViewContextInterface ;
13
16
use Yii ;
@@ -29,6 +32,16 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
29
32
public function render ($ context , $ targetDir )
30
33
{
31
34
$ types = array_merge ($ context ->classes , $ context ->interfaces , $ context ->traits );
35
+ foreach ($ types as $ name => $ type ) {
36
+ $ types [$ name ] = (array ) $ type ;
37
+ if ($ type instanceof ClassDoc) {
38
+ $ types [$ name ]['type ' ] = 'class ' ;
39
+ } elseif ($ type instanceof InterfaceDoc) {
40
+ $ types [$ name ]['type ' ] = 'interface ' ;
41
+ } elseif ($ type instanceof TraitDoc) {
42
+ $ types [$ name ]['type ' ] = 'trait ' ;
43
+ }
44
+ }
32
45
file_put_contents ($ targetDir . '/types.json ' , json_encode ($ types , JSON_PRETTY_PRINT ));
33
46
}
34
47
You can’t perform that action at this time.
0 commit comments