src/Model/GetParamsRequest/GetParamsRequest.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Model\GetParamsRequest;
  3. use Symfony\Component\Serializer\Annotation\Groups;
  4. /**
  5.  * Class GetParamsRequest.
  6.  */
  7. final class GetParamsRequest
  8. {
  9.     /**
  10.      * @Groups({"get_params"})
  11.      *
  12.      * @var array
  13.      */
  14.     private $data = [];
  15.     /**
  16.      * @return array
  17.      */
  18.     public function getData(): array
  19.     {
  20.         return $this->data;
  21.     }
  22.     /**
  23.      * @param array $data
  24.      *
  25.      * @return GetParamsRequest
  26.      */
  27.     public function setData(array $data): GetParamsRequest
  28.     {
  29.         $this->data $data;
  30.         return $this;
  31.     }
  32.     /**
  33.      * @param string $key
  34.      *
  35.      * @return array
  36.      */
  37.     public function getParams(string $key): array
  38.     {
  39.         return is_array($this->getData())
  40.         && isset($this->getData()[$key])
  41.         && isset($this->getData()[$key]['params']) ? $this->getData()[$key]['params'] : [];
  42.     }
  43. }