TestController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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(TestRequest $request)
  25. {
  26. return '';
  27. }
  28. public function checkCustomHeaders(Request $request)
  29. {
  30. return $request->headers->all();
  31. }
  32. public function fetchRouteResponse()
  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. public function utf8()
  49. {
  50. return ['result' => 'Лорем ипсум долор сит амет'];
  51. }
  52. /**
  53. * @hideFromAPIDocumentation
  54. */
  55. public function skip()
  56. {
  57. }
  58. /**
  59. * @response {
  60. * "data": []
  61. *}
  62. */
  63. public function withResponseTag()
  64. {
  65. return '';
  66. }
  67. /**
  68. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  69. */
  70. public function transformerTag()
  71. {
  72. return '';
  73. }
  74. /**
  75. * @transformer \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  76. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  77. */
  78. public function transformerTagWithModel()
  79. {
  80. return '';
  81. }
  82. /**
  83. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  84. */
  85. public function transformerCollectionTag()
  86. {
  87. return '';
  88. }
  89. /**
  90. * @transformercollection \Mpociot\ApiDoc\Tests\Fixtures\TestTransformer
  91. * @transformermodel \Mpociot\ApiDoc\Tests\Fixtures\TestModel
  92. */
  93. public function transformerCollectionTagWithModel()
  94. {
  95. return '';
  96. }
  97. }