TestController.php 2.6 KB

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