11<?php
2+
23/**
34 * @link https://www.yiiframework.com/
45 * @copyright Copyright (c) 2008 Yii Software LLC
@@ -62,7 +63,6 @@ class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
6263 */
6364 private $ _targetDir ;
6465
65-
6666 /**
6767 * @inheritdoc
6868 */
@@ -114,7 +114,7 @@ public function render($context, $targetDir)
114114 }
115115
116116 $ done = 0 ;
117- $ higlighter = new Highlighter ;
117+ $ higlighter = new Highlighter () ;
118118
119119 foreach ($ types as $ type ) {
120120 $ fileContent = $ this ->renderWithLayout ($ this ->typeView , [
@@ -139,23 +139,6 @@ public function render($context, $targetDir)
139139 }
140140 }
141141
142- /**
143- * Renders file applying layout
144- * @param string $viewFile the view name
145- * @param array $params the parameters (name-value pairs) that will be extracted and made available in the view file.
146- * @return string
147- */
148- protected function renderWithLayout ($ viewFile , $ params )
149- {
150- $ output = $ this ->getView ()->render ($ viewFile , $ params , $ this );
151- if ($ this ->layout !== false ) {
152- $ params ['content ' ] = $ output ;
153- return $ this ->getView ()->renderFile ($ this ->layout , $ params , $ this );
154- }
155-
156- return $ output ;
157- }
158-
159142 /**
160143 * @param ClassDoc $class
161144 * @return string
@@ -274,7 +257,7 @@ public function renderMethodSignature(MethodDoc $method, ?TypeDoc $context = nul
274257 . ApiMarkdown::highlight (
275258 $ param ->name
276259 . ($ param ->isOptional ? ' = ' . $ this ->renderDefaultValue ($ param ->defaultValue ) : '' ),
277- 'php '
260+ 'php ' ,
278261 );
279262 }
280263
@@ -335,38 +318,55 @@ public function generateApiUrl($typeName)
335318 }
336319
337320 /**
338- * Generates file name for API page for a given type
339- * @param string $typeName
340- * @return string
321+ * @inheritdoc
341322 */
342- protected function generateFileName ( $ typeName )
323+ public function getViewPath ( )
343324 {
344- return strtolower ( str_replace ( '\\' , ' - ' , $ typeName )) . ' . html' ;
325+ return Yii:: getAlias ( ' @yii/apidoc/templates/ html/views ' ) ;
345326 }
346327
347328 /**
348329 * @inheritdoc
349330 */
350- public function getViewPath ( )
331+ public function getSourceUrl ( $ type , $ line = null )
351332 {
352- return Yii:: getAlias ( ' @yii/apidoc/templates/html/views ' ) ;
333+ return null ;
353334 }
354335
355336 /**
356- * @inheritdoc
337+ * Renders file applying layout
338+ * @param string $viewFile the view name
339+ * @param array $params the parameters (name-value pairs) that will be extracted and made available in the view file.
340+ * @return string
357341 */
358- protected function generateLink ( $ text , $ href , $ options = [] )
342+ protected function renderWithLayout ( $ viewFile , $ params )
359343 {
360- $ options ['href ' ] = $ href ;
344+ $ output = $ this ->getView ()->render ($ viewFile , $ params , $ this );
345+ if ($ this ->layout !== false ) {
346+ $ params ['content ' ] = $ output ;
347+ return $ this ->getView ()->renderFile ($ this ->layout , $ params , $ this );
348+ }
361349
362- return Html::a ($ text , null , $ options );
350+ return $ output ;
351+ }
352+
353+ /**
354+ * Generates file name for API page for a given type
355+ * @param string $typeName
356+ * @return string
357+ */
358+ protected function generateFileName ($ typeName )
359+ {
360+ return strtolower (str_replace ('\\' , '- ' , $ typeName )) . '.html ' ;
363361 }
364362
365363 /**
366364 * @inheritdoc
367365 */
368- public function getSourceUrl ( $ type , $ line = null )
366+ protected function generateLink ( $ text , $ href , $ options = [] )
369367 {
370- return null ;
368+ $ options ['href ' ] = $ href ;
369+
370+ return Html::a ($ text , null , $ options );
371371 }
372372}
0 commit comments