vendor/symfony/mercure/src/Update.php line 26

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Mercure Component project.
  4.  *
  5.  * (c) Kévin Dunglas <dunglas@gmail.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. declare(strict_types=1);
  11. namespace Symfony\Component\Mercure;
  12. /**
  13.  * Represents an update to send to the hub.
  14.  *
  15.  * @see https://github.com/dunglas/mercure/blob/main/spec/mercure.md#hub
  16.  * @see https://github.com/dunglas/mercure/blob/main/update.go
  17.  *
  18.  * @author Kévin Dunglas <dunglas@gmail.com>
  19.  *
  20.  * @experimental
  21.  */
  22. final class Update
  23. {
  24.     private $topics;
  25.     private $data;
  26.     private $private;
  27.     private $id;
  28.     private $type;
  29.     private $retry;
  30.     /**
  31.      * @param string|string[] $topics
  32.      */
  33.     public function __construct($topicsstring $data ''bool $private false, ?string $id null, ?string $type null, ?int $retry null)
  34.     {
  35.         if (!\is_array($topics) && !\is_string($topics)) {
  36.             throw new \InvalidArgumentException('$topics must be an array of strings or a string.');
  37.         }
  38.         $this->topics = (array) $topics;
  39.         $this->data $data;
  40.         $this->private $private;
  41.         $this->id $id;
  42.         $this->type $type;
  43.         $this->retry $retry;
  44.     }
  45.     public function getTopics(): array
  46.     {
  47.         return $this->topics;
  48.     }
  49.     public function getData(): string
  50.     {
  51.         return $this->data;
  52.     }
  53.     public function isPrivate(): bool
  54.     {
  55.         return $this->private;
  56.     }
  57.     public function getId(): ?string
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getType(): ?string
  62.     {
  63.         return $this->type;
  64.     }
  65.     public function getRetry(): ?int
  66.     {
  67.         return $this->retry;
  68.     }
  69. }