TestController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. /**
  33. * @authenticated
  34. */
  35. public function withAuthenticatedTag()
  36. {
  37. return '';
  38. }
  39. public function checkCustomHeaders(Request $request)
  40. {
  41. return $request->headers->all();
  42. }
  43. public function shouldFetchRouteResponse()
  44. {
  45. $fixture = new \stdClass();
  46. $fixture->id = 1;
  47. $fixture->name = 'banana';
  48. $fixture->color = 'red';
  49. $fixture->weight = 300;
  50. $fixture->delicious = 1;
  51. return [
  52. 'id' => (int) $fixture->id,
  53. 'name' => ucfirst($fixture->name),
  54. 'color' => ucfirst($fixture->color),
  55. 'weight' => $fixture->weight.' grams',
  56. 'delicious' => (bool) $fixture->delicious,
  57. ];
  58. }
  59. /**
  60. * @response {
  61. * "result": "Лорем ипсум долор сит амет"
  62. * }
  63. */
  64. public function withUtf8ResponseTag()
  65. {
  66. return ['result' => 'Лорем ипсум долор сит амет'];
  67. }
  68. /**
  69. * @hideFromAPIDocumentation
  70. */
  71. public function skip()
  72. {
  73. }
  74. /**
  75. * @response {
  76. * "id": 4,
  77. * "name": "banana",
  78. * "color": "red",
  79. * "weight": "1 kg",
  80. * "delicious": true
  81. * }
  82. */
  83. public function withResponseTag()
  84. {
  85. return '';
  86. }
  87. /**
  88. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  89. */
  90. public function transformerTag()
  91. {
  92. return '';
  93. }
  94. /**
  95. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  96. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  97. */
  98. public function transformerTagWithModel()
  99. {
  100. return '';
  101. }
  102. /**
  103. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  104. */
  105. public function transformerCollectionTag()
  106. {
  107. return '';
  108. }
  109. /**
  110. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  111. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  112. */
  113. public function transformerCollectionTagWithModel()
  114. {
  115. return '';
  116. }
  117. }