ApiRenderer.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. namespace yii\apidoc\templates\json;
  8. use yii\apidoc\models\Context;
  9. use yii\apidoc\renderers\ApiRenderer as BaseApiRenderer;
  10. use yii\base\ViewContextInterface;
  11. use Yii;
  12. /**
  13. * The class for outputting documentation data structures as a JSON text.
  14. *
  15. * @author Tom Worster <fsb@thefsb.org>
  16. * @since 2.0.5
  17. */
  18. class ApiRenderer extends BaseApiRenderer implements ViewContextInterface
  19. {
  20. /**
  21. * Writes a given [[Context]] as JSON text to file 'types.json'.
  22. *
  23. * @param Context $context the api documentation context to render.
  24. * @param $targetDir
  25. */
  26. public function render($context, $targetDir)
  27. {
  28. $types = array_merge($context->classes, $context->interfaces, $context->traits);
  29. file_put_contents($targetDir . '/types.json', json_encode($types, JSON_PRETTY_PRINT));
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function generateApiUrl($typeName)
  35. {
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. protected function generateFileName($typeName)
  41. {
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function getViewPath()
  47. {
  48. }
  49. /**
  50. * @inheritdoc
  51. */
  52. protected function generateLink($text, $href, $options = [])
  53. {
  54. }
  55. /**
  56. * @inheritdoc
  57. */
  58. public function getSourceUrl($type, $line = null)
  59. {
  60. }
  61. }