| 1 | <?php | ||
| 8 | class Ticket | ||
| 9 | { | ||
| 10 | /** | ||
| 11 | * Cache manager. | ||
| 12 | * | ||
| 13 | * @var \Doctrine\Common\Cache\Cache | ||
| 14 | */ | ||
| 15 | protected $cache; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * Suite Id. | ||
| 19 | * | ||
| 20 | * @var string | ||
| 21 | */ | ||
| 22 | protected $suiteId; | ||
| 23 | /** | ||
| 24 | * Cache key prefix. | ||
| 25 | * | ||
| 26 | * @var string | ||
| 27 | */ | ||
| 28 | protected $prefix = 'EntWeChat.suite.suite_ticket.'; | ||
| 29 | /** | ||
| 30 | * Cache Key. | ||
| 31 | * | ||
| 32 | * @var string | ||
| 33 | */ | ||
| 34 | private $cacheKey; | ||
| 35 | |||
| 36 | /** | ||
| 37 | * Ticket constructor. | ||
| 38 | * | ||
| 39 | * @param string $suiteId | ||
| 40 | * @param \Doctrine\Common\Cache\Cache $cache | ||
| 41 | */ | ||
| 42 | public function __construct($suiteId, Cache $cache) | ||
| 47 | |||
| 48 | /** | ||
| 49 | * Set component verify ticket to the cache. | ||
| 50 | * | ||
| 51 | * @param string $ticket | ||
| 52 | * | ||
| 53 | * @return bool | ||
| 54 | */ | ||
| 55 | public function setTicket($ticket) | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Get component verify ticket cache key. | ||
| 62 | * | ||
| 63 | * @return string $this->cacheKey | ||
| 64 | */ | ||
| 65 | public function getCacheKey() | ||
| 73 | |||
| 74 | /** | ||
| 75 | * Set component verify ticket cache key. | ||
| 76 | * | ||
| 77 | * @param string $cacheKey | ||
| 78 | * | ||
| 79 | * @return $this | ||
| 80 | */ | ||
| 81 | public function setCacheKey($cacheKey) | ||
| 87 | |||
| 88 | /** | ||
| 89 | * Get component verify ticket. | ||
| 90 | * | ||
| 91 | * @throws \EntWeChat\Core\Exceptions\RuntimeException | ||
| 92 | * | ||
| 93 | * @return string | ||
| 94 | */ | ||
| 95 | public function getTicket() | ||
| 103 | } | ||
| 104 |