src/Entity/CachedResponse.php line 16

Open in your IDE?
  1. <?php
  2. /**
  3.  * @license SILK SOFTWARE HOUSE SP Z O O
  4.  */
  5. namespace App\Entity;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * Cached response
  9.  *
  10.  * @ORM\Table(name="cached_responses")
  11.  * @ORM\Entity(repositoryClass="App\Repository\CachedResponseRepository")
  12.  */
  13. class CachedResponse
  14. {
  15.     /**
  16.      * Auto-incremented id.
  17.      *
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="id", type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      */
  24.     private $id;
  25.     /**
  26.      * Idempotence hash.
  27.      *
  28.      * @var string
  29.      *
  30.      * @ORM\Column(name="request_id", type="text", options={"description": "Idempotence hash."})
  31.      */
  32.     private $idempotenceHash;
  33.     /**
  34.      * Response code.
  35.      *
  36.      * @var int
  37.      *
  38.      * @ORM\Column(name="response_code", type="integer")
  39.      */
  40.     private $responseCode 200;
  41.     /**
  42.      * Response.
  43.      *
  44.      * @var string
  45.      *
  46.      * @ORM\Column(name="response", type="text", nullable=false)
  47.      */
  48.     private $response;
  49.     /**
  50.      * Route.
  51.      *
  52.      * @var string
  53.      *
  54.      * @ORM\Column(name="route", type="string", length=255, nullable=false)
  55.      */
  56.     private $route;
  57.     /**
  58.      * Get auto-incremented id.
  59.      *
  60.      * @return int
  61.      */
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     /**
  67.      * Get request string.
  68.      *
  69.      * @return string
  70.      */
  71.     public function getIdempotenceHash(): string
  72.     {
  73.         return $this->idempotenceHash;
  74.     }
  75.     /**
  76.      * Set request id.
  77.      *
  78.      * @param string $idempotenceHash
  79.      *
  80.      * @return CachedResponse
  81.      */
  82.     public function setIdempotenceHash(string $idempotenceHash): CachedResponse
  83.     {
  84.         $this->idempotenceHash $idempotenceHash;
  85.         return $this;
  86.     }
  87.     /**
  88.      * Get response code.
  89.      *
  90.      * @return int
  91.      */
  92.     public function getResponseCode(): int
  93.     {
  94.         return $this->responseCode;
  95.     }
  96.     /**
  97.      * Get new (not 201) response code.
  98.      *
  99.      * @return int
  100.      */
  101.     public function getNot201ResponseCode(): int
  102.     {
  103.         return 201 === $this->responseCode 200 $this->responseCode;
  104.     }
  105.     /**
  106.      * Set response code.
  107.      *
  108.      * @param int $responseCode
  109.      *
  110.      * @return CachedResponse
  111.      */
  112.     public function setResponseCode(int $responseCode): CachedResponse
  113.     {
  114.         $this->responseCode $responseCode;
  115.         return $this;
  116.     }
  117.     /**
  118.      * Get response.
  119.      *
  120.      * @return string
  121.      */
  122.     public function getResponse(): string
  123.     {
  124.         return $this->response;
  125.     }
  126.     /**
  127.      * Set response.
  128.      *
  129.      * @param string $response
  130.      *
  131.      * @return CachedResponse
  132.      */
  133.     public function setResponse(string $response): CachedResponse
  134.     {
  135.         $this->response $response;
  136.         return $this;
  137.     }
  138.     /**
  139.      * Get route.
  140.      *
  141.      * @return string
  142.      */
  143.     public function getRoute(): string
  144.     {
  145.         return $this->route;
  146.     }
  147.     /**
  148.      * Set route.
  149.      *
  150.      * @param string $route
  151.      *
  152.      * @return CachedResponse
  153.      */
  154.     public function setRoute(string $route): CachedResponse
  155.     {
  156.         $this->route $route;
  157.         return $this;
  158.     }
  159. }