vendor/bitbag/wishlist-plugin/src/Entity/WishlistToken.php line 15

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file was created by developers working at BitBag
  4.  * Do you need more information about us and what we do? Visit our https://bitbag.io website!
  5.  * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
  6. */
  7. declare(strict_types=1);
  8. namespace BitBag\SyliusWishlistPlugin\Entity;
  9. use Ramsey\Uuid\Uuid;
  10. class WishlistToken implements WishlistTokenInterface
  11. {
  12.     protected string $value;
  13.     public function __construct(?string $value null)
  14.     {
  15.         if (null === $value) {
  16.             $this->value $this->generate();
  17.         } else {
  18.             $this->setValue($value);
  19.         }
  20.     }
  21.     public function getValue(): string
  22.     {
  23.         return $this->value;
  24.     }
  25.     public function setValue(string $value): void
  26.     {
  27.         $this->value $value;
  28.     }
  29.     public function __toString(): string
  30.     {
  31.         return $this->getValue();
  32.     }
  33.     private function generate(): string
  34.     {
  35.         return Uuid::uuid4()->toString();
  36.     }
  37. }