vendor/gollumsf/rest-bundle/src/Annotation/Serialize.php line 11

Open in your IDE?
  1. <?php
  2. namespace GollumSF\RestBundle\Annotation;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation;
  4. use Symfony\Component\HttpFoundation\Response;
  5. /**
  6.  * @Annotation
  7.  * @Target({"CLASS", "METHOD"})
  8.  */
  9. class Serialize extends ConfigurationAnnotation {
  10.     const ALIAS_NAME 'gsf_serialize';
  11.     /**
  12.      * @var int
  13.      */
  14.     private $code Response::HTTP_OK;
  15.     /**
  16.      * @var string[]
  17.      */
  18.     private $groups = [];
  19.     /**
  20.      * @var string[]
  21.      */
  22.     private $headers = [];
  23.     /////////////
  24.     // Getters //
  25.     /////////////
  26.     public function getCode(): int {
  27.         return $this->code;
  28.     }
  29.     public function getGroups(): array {
  30.         return $this->groups;
  31.     }
  32.     public function getHeaders(): array {
  33.         return $this->headers;
  34.     }
  35.     public function getAliasName() {
  36.         return self::ALIAS_NAME;
  37.     }
  38.     public function allowArray() {
  39.         return false;
  40.     }
  41.     /////////////
  42.     // Setters //
  43.     /////////////
  44.     public function setCode(int $code): self {
  45.         $this->code $code;
  46.         return $this;
  47.     }
  48.     /**
  49.      * @param string|string[] $groups
  50.      */
  51.     public function setGroups($groups): self {
  52.         if (!is_array($groups)) {
  53.             $groups = [$groups];
  54.         }
  55.         $this->groups $groups;
  56.         return $this;
  57.     }
  58.     public function setHeaders(array $headers): self {
  59.         $this->headers $headers;
  60.         return $this;
  61.     }
  62. }