Code Duplication    Length = 14-16 lines in 2 locations

src/Card/Card.php 1 location

@@ 176-191 (lines=16) @@
173
     *
174
     * @return string $apiTicket
175
     */
176
    public function cardApiTicket($refresh = false)
177
    {
178
        $key = self::TICKET_CACHE_PREFIX.$this->getAccessToken()->getAppId();
179
180
        $ticket = $this->getCache()->fetch($key);
181
182
        if (!$ticket || $refresh) {
183
            $result = $this->parseJSON('get', [self::API_GET_CARD_TICKET, ['type' => 'wx_card']]);
184
185
            $this->getCache()->save($key, $result['ticket'], $result['expires_in'] - 500);
186
187
            return $result['ticket'];
188
        }
189
190
        return $ticket;
191
    }
192
193
    /**
194
     * 微信卡券:JSAPI 卡券Package - 基础参数没有附带任何值 - 再生产环境中需要根据实际情况进行修改.

src/Js/Js.php 1 location

@@ 100-113 (lines=14) @@
97
     *
98
     * @return string
99
     */
100
    public function ticket()
101
    {
102
        $key = self::TICKET_CACHE_PREFIX.$this->getAccessToken()->getAppId();
103
104
        if ($ticket = $this->getCache()->fetch($key)) {
105
            return $ticket;
106
        }
107
108
        $result = $this->parseJSON('get', [self::API_TICKET, ['type' => 'jsapi']]);
109
110
        $this->getCache()->save($key, $result['ticket'], $result['expires_in'] - 500);
111
112
        return $result['ticket'];
113
    }
114
115
    /**
116
     * Build signature.