TestController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. namespace Mpociot\ApiDoc\Tests\Fixtures;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Routing\Controller;
  5. class TestController extends Controller
  6. {
  7. public function dummy()
  8. {
  9. return '';
  10. }
  11. /**
  12. * Example title.
  13. * This will be the long description.
  14. * It can also be multiple lines long.
  15. */
  16. public function withEndpointDescription()
  17. {
  18. return '';
  19. }
  20. /**
  21. * @bodyParam title string required The title of the post.
  22. * @bodyParam body string required The title of the post.
  23. * @bodyParam type string The type of post to create. Defaults to 'textophonious'.
  24. @bodyParam author_id int the ID of the author
  25. * @bodyParam thumbnail image This is required if the post type is 'imagelicious
  26. */
  27. public function withBodyParameters()
  28. {
  29. return '';
  30. }
  31. /**
  32. * @authenticated
  33. */
  34. public function withAuthenticatedTag()
  35. {
  36. return '';
  37. }
  38. public function checkCustomHeaders(Request $request)
  39. {
  40. return $request->headers->all();
  41. }
  42. public function shouldFetchRouteResponse()
  43. {
  44. $fixture = new \stdClass();
  45. $fixture->id = 1;
  46. $fixture->name = 'banana';
  47. $fixture->color = 'red';
  48. $fixture->weight = 300;
  49. $fixture->delicious = 1;
  50. return [
  51. 'id' => (int) $fixture->id,
  52. 'name' => ucfirst($fixture->name),
  53. 'color' => ucfirst($fixture->color),
  54. 'weight' => $fixture->weight.' grams',
  55. 'delicious' => (bool) $fixture->delicious,
  56. ];
  57. }
  58. /**
  59. * @response {
  60. * "result": "Лорем ипсум долор сит амет"
  61. * }
  62. */
  63. public function withUtf8ResponseTag()
  64. {
  65. return ['result' => 'Лорем ипсум долор сит амет'];
  66. }
  67. /**
  68. * @hideFromAPIDocumentation
  69. */
  70. public function skip()
  71. {
  72. }
  73. /**
  74. * @response {
  75. * "id": 4,
  76. * "name": "banana",
  77. * "color": "red",
  78. * "weight": "1 kg",
  79. * "delicious": true
  80. * }
  81. */
  82. public function withResponseTag()
  83. {
  84. return '';
  85. }
  86. /**
  87. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  88. */
  89. public function transformerTag()
  90. {
  91. return '';
  92. }
  93. /**
  94. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  95. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  96. */
  97. public function transformerTagWithModel()
  98. {
  99. return '';
  100. }
  101. /**
  102. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  103. */
  104. public function transformerCollectionTag()
  105. {
  106. return '';
  107. }
  108. /**
  109. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  110. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  111. */
  112. public function transformerCollectionTagWithModel()
  113. {
  114. return '';
  115. }
  116. }