vendor/friendsofsymfony/rest-bundle/Controller/Annotations/View.php line 23

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the FOSRestBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FOS\RestBundle\Controller\Annotations;
  11. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  12. /**
  13. * View annotation class.
  14. *
  15. * @Annotation
  16. * @Target({"METHOD","CLASS"})
  17. */
  18. #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
  19. class View extends Template
  20. {
  21. /**
  22. * @var int|null
  23. */
  24. protected $statusCode;
  25. /**
  26. * @var array
  27. */
  28. protected $serializerGroups;
  29. /**
  30. * @var bool
  31. */
  32. protected $serializerEnableMaxDepthChecks;
  33. /**
  34. * @param array|string $data
  35. */
  36. public function __construct(
  37. $data = [],
  38. array $vars = [],
  39. bool $isStreamable = false,
  40. array $owner = [],
  41. ?int $statusCode = null,
  42. array $serializerGroups = [],
  43. bool $serializerEnableMaxDepthChecks = false
  44. ) {
  45. parent::__construct($data, $vars, $isStreamable, $owner);
  46. $values = is_array($data) ? $data : [];
  47. $this->statusCode = $values['statusCode'] ?? $statusCode;
  48. $this->serializerGroups = $values['serializerGroups'] ?? $serializerGroups;
  49. $this->serializerEnableMaxDepthChecks = $values['serializerEnableMaxDepthChecks'] ?? $serializerEnableMaxDepthChecks;
  50. }
  51. /**
  52. * @param int $statusCode
  53. */
  54. public function setStatusCode($statusCode)
  55. {
  56. $this->statusCode = $statusCode;
  57. }
  58. /**
  59. * @return int|null
  60. */
  61. public function getStatusCode()
  62. {
  63. return $this->statusCode;
  64. }
  65. /**
  66. * @param array $serializerGroups
  67. */
  68. public function setSerializerGroups($serializerGroups)
  69. {
  70. $this->serializerGroups = $serializerGroups;
  71. }
  72. /**
  73. * @return array
  74. */
  75. public function getSerializerGroups()
  76. {
  77. return $this->serializerGroups;
  78. }
  79. /**
  80. * @param bool $serializerEnableMaxDepthChecks
  81. */
  82. public function setSerializerEnableMaxDepthChecks($serializerEnableMaxDepthChecks)
  83. {
  84. $this->serializerEnableMaxDepthChecks = $serializerEnableMaxDepthChecks;
  85. }
  86. /**
  87. * @return bool
  88. */
  89. public function getSerializerEnableMaxDepthChecks()
  90. {
  91. return $this->serializerEnableMaxDepthChecks;
  92. }
  93. }