TestController.php 3.0 KB

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