TestController.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 user_id int required The id of the user.
  22. * @bodyParam room_id string The id of the room.
  23. * @bodyParam forever boolean Whether to ban the user forever.
  24. * @bodyParam another_one number Just need something here.
  25. * @bodyParam yet_another_param object required
  26. * @bodyParam even_more_param array
  27. */
  28. public function withBodyParameters()
  29. {
  30. return '';
  31. }
  32. public function checkCustomHeaders(Request $request)
  33. {
  34. return $request->headers->all();
  35. }
  36. public function shouldFetchRouteResponse()
  37. {
  38. $fixture = new \stdClass();
  39. $fixture->id = 1;
  40. $fixture->name = 'banana';
  41. $fixture->color = 'red';
  42. $fixture->weight = 300;
  43. $fixture->delicious = 1;
  44. return [
  45. 'id' => (int) $fixture->id,
  46. 'name' => ucfirst($fixture->name),
  47. 'color' => ucfirst($fixture->color),
  48. 'weight' => $fixture->weight.' grams',
  49. 'delicious' => (bool) $fixture->delicious,
  50. ];
  51. }
  52. /**
  53. * @response {
  54. * "result": "Лорем ипсум долор сит амет"
  55. * }
  56. */
  57. public function withUtf8ResponseTag()
  58. {
  59. return ['result' => 'Лорем ипсум долор сит амет'];
  60. }
  61. /**
  62. * @hideFromAPIDocumentation
  63. */
  64. public function skip()
  65. {
  66. }
  67. /**
  68. * @response {
  69. * "id": 4,
  70. * "name": "banana",
  71. * "color": "red",
  72. * "weight": "1 kg",
  73. * "delicious": true
  74. * }
  75. */
  76. public function withResponseTag()
  77. {
  78. return '';
  79. }
  80. /**
  81. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  82. */
  83. public function transformerTag()
  84. {
  85. return '';
  86. }
  87. /**
  88. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  89. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  90. */
  91. public function transformerTagWithModel()
  92. {
  93. return '';
  94. }
  95. /**
  96. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  97. */
  98. public function transformerCollectionTag()
  99. {
  100. return '';
  101. }
  102. /**
  103. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  104. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  105. */
  106. public function transformerCollectionTagWithModel()
  107. {
  108. return '';
  109. }
  110. }