Completed
Pull Request — master (#464)
by
unknown
03:15
created

Card::getColors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
/**
13
 * Card.php.
14
 *
15
 * @author    overtrue <[email protected]>
16
 * @copyright 2016 overtrue <[email protected]>
17
 *
18
 * @link      https://github.com/overtrue
19
 * @link      http://overtrue.me
20
 */
21
22
namespace EasyWeChat\Card;
23
24
use Doctrine\Common\Cache\Cache;
25
use Doctrine\Common\Cache\FilesystemCache;
26
use EasyWeChat\Core\AbstractAPI;
27
use Psr\Http\Message\ResponseInterface;
28
29
class Card extends AbstractAPI
30
{
31
    /**
32
     * Cache.
33
     *
34
     * @var Cache
35
     */
36
    protected $cache;
37
38
    /**
39
     * Ticket cache prefix.
40
     */
41
    const TICKET_CACHE_PREFIX = 'overtrue.wechat.card_api_ticket.';
42
43
    const API_GET_COLORS            = 'https://api.weixin.qq.com/card/getcolors';
44
    const API_CREATE                = 'https://api.weixin.qq.com/card/create';
45
    const API_QRCODE_CREATE         = 'https://api.weixin.qq.com/card/qrcode/create';
46
    const API_QRCODE_SHOW           = 'https://mp.weixin.qq.com/cgi-bin/showqrcode';
47
    const API_GET_CARD_TICKET       = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket';
48
    const API_LANDING_PAGE          = 'https://api.weixin.qq.com/card/landingpage/create';
49
    const API_DEPOSIT               = 'https://api.weixin.qq.com/card/code/deposit';
50
    const API_GET_DEPOSIT_COUNT     = 'https://api.weixin.qq.com/card/code/getdepositcount';
51
    const API_CHECK_CODE            = 'https://api.weixin.qq.com/card/code/checkcode';
52
    const API_GET_HTML              = 'https://api.weixin.qq.com/card/mpnews/gethtml';
53
    const API_TEST_WHITE_LIST       = 'https://api.weixin.qq.com/card/testwhitelist/set';
54
    const API_CODE_GET              = 'https://api.weixin.qq.com/card/code/get';
55
    const API_CONSUME               = 'https://api.weixin.qq.com/card/code/consume';
56
    const API_DECRYPT               = 'https://api.weixin.qq.com/card/code/decrypt';
57
    const API_GET_CARD_LIST         = 'https://api.weixin.qq.com/card/user/getcardlist';
58
    const API_CARD_GET              = 'https://api.weixin.qq.com/card/get';
59
    const API_BATCH_GET             = 'https://api.weixin.qq.com/card/batchget';
60
    const API_UPDATE                = 'https://api.weixin.qq.com/card/update';
61
    const API_PAY_CELL_SET          = 'https://api.weixin.qq.com/card/paycell/set';
62
    const API_MODIFY_STOCK          = 'https://api.weixin.qq.com/card/modifystock';
63
    const API_CODE_UPDATE           = 'https://api.weixin.qq.com/card/code/update';
64
    const API_CARD_DELETE           = 'https://api.weixin.qq.com/card/delete';
65
    const API_UNAVAILABLE           = 'https://api.weixin.qq.com/card/code/unavailable';
66
    const API_CARD_BIZ_UIN_INFO     = 'https://api.weixin.qq.com/datacube/getcardbizuininfo';
67
    const API_CARD_CARD_INFO        = 'https://api.weixin.qq.com/datacube/getcardcardinfo';
68
    const API_CARD_MEMBER_CARD_INFO = 'https://api.weixin.qq.com/datacube/getcardmembercardinfo';
69
    const API_CARD_ACTIVATE         = 'https://api.weixin.qq.com/card/membercard/activate';
70
    const API_ACTIVATE_USER_FORM    = 'https://api.weixin.qq.com/card/membercard/activateuserform/set';
71
    const API_MEMBER_USER_INFO      = 'https://api.weixin.qq.com/card/membercard/userinfo/get';
72
    const API_UPDATE_USER           = 'https://api.weixin.qq.com/card/membercard/updateuser';
73
    const API_SUB_MERCHANT          = 'https://api.weixin.qq.com/card/submerchant/submit';
74
    const API_GET_APPLY_PROTOCOL    = 'https://api.weixin.qq.com/card/getapplyprotocol';
75
76
    /**
77
     * 获取卡券颜色
78
     *
79
     * @return array
80
     */
81
    public function getColors()
82
    {
83
        return $this->parseJSON('get', [self::API_GET_COLORS]);
84
    }
85
86
    /**
87
     * 创建卡券
88
     *
89
     * @param string $card_type
90
     * @param array  $base_info
91
     * @param array  $especial
92
     * @param array  $advanced_info
93
     *
94
     * @return bool|array
95
     */
96
    public function create($card_type = 'member_card', $base_info = [], $especial = [], $advanced_info = [])
97
    {
98
        $card                      = [];
99
        $card['card']              = [];
100
        $card['card']['card_type'] = strtoupper($card_type);
101
102
        $type = strtolower($card_type);
103
104
        $card_info              = [];
105
        $card_info['base_info'] = $base_info;
106
107
        $card['card'][$type] = [];
108
        $card['card'][$type] = array_merge($card_info, $especial, $advanced_info);
109
110
        if (is_string($card_type) && is_array($base_info) && is_array($especial)) {
111
            return $this->parseJSON('json', [self::API_CREATE, $card]);
112
        }
113
114
        return false;
115
    }
116
117
    /**
118
     * 创建二维码
119
     *
120
     * @param array $card_list
121
     *
122
     * @return array|bool
123
     */
124
    public function qrCode($card_list = [])
125
    {
126
        return $this->parseJSON('json', [self::API_QRCODE_CREATE, $card_list]);
127
    }
128
129
    /**
130
     * ticket 换取二维码图片
131
     *
132
     * @param null $ticket
133
     *
134
     * @return array
135
     */
136
    public function showQrCode($ticket = null)
137
    {
138
        $params = [
139
            'ticket' => $ticket,
140
        ];
141
142
        $http = $this->getHttp();
143
144
        /** @var ResponseInterface $response */
145
        $response = $http->get(self::API_QRCODE_SHOW, $params);
146
147
        return [
148
            'status'  => $response->getStatusCode(),
149
            'reason'  => $response->getReasonPhrase(),
150
            'headers' => $response->getHeaders(),
151
            'body'    => strval($response->getBody()),
152
            'url'     => self::API_QRCODE_SHOW . '?' . http_build_query($params),
153
        ];
154
    }
155
156
    /**
157
     * 通过ticket换取二维码 链接
158
     *
159
     * @param $ticket
160
     *
161
     * @return string
162
     */
163
    public function showQrCode_Url($ticket)
164
    {
165
        $params = '?ticket=' . $ticket;
166
167
        return self::API_QRCODE_SHOW . $params;
168
    }
169
170
    /**
171
     * 获取 卡券 Api_ticket
172
     *
173
     * @param  boolean $jus 是否强制刷新
174
     *
175
     * @return string  $api_ticket  api_ticket
176
     */
177
    public function cardApiTicket($jus = false)
178
    {
179
        $key = self::TICKET_CACHE_PREFIX . $this->getAccessToken()->getAppId();
180
181
        $ticket = $this->getCache()->fetch($key);
182
183
        if (!$ticket || $jus) {
184
            $result = $this->parseJSON('get', [self::API_GET_CARD_TICKET, ['type' => 'wx_card']]);
185
186
            $this->getCache()->save($key, $result['ticket'], $result['expires_in'] - 500);
187
188
            return $result;
189
        }
190
191
        return $ticket;
192
    }
193
194
    /**
195
     * 微信卡券:JSAPI 卡券Package - 基础参数没有附带任何值 - 再生产环境中需要根据实际情况进行修改
196
     *
197
     * @param array $card_list
198
     * @param null  $timestamp
199
     * @param null  $api_ticket
200
     *
201
     * @return string
202
     */
203
    public function wxCardPackage(array $card_list, $timestamp = null, $api_ticket = null)
204
    {
205
        if (empty($timestamp) || $timestamp == '') {
206
            $timestamp = time();
207
        }
208
209
        if (empty($api_ticket) || $api_ticket == '') {
210
            $api_ticket = $this->cardApiTicket();
211
        }
212
213
        $resultArray = [];
214
        foreach ($card_list as $key => $value) {
215 View Code Duplication
            if (empty($value['code']) || !isset($value['code'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
216
                $value['code'] = '';
217
            }
218
219 View Code Duplication
            if (empty($value['openid']) || !isset($value['openid'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
220
                $value['openid'] = '';
221
            }
222
223
            $arrays = [$api_ticket, $timestamp, $value['card_id'], $value['code'], $value['openid']];
224
            sort($arrays, SORT_STRING);
225
            $string = sha1(implode($arrays));
226
227
            $resultArray['cardList'][$key]['cardId']            = $value['card_id'];
228
            $resultArray['cardList'][$key]['cardExt']['code']   = $value['code'];
229
            $resultArray['cardList'][$key]['cardExt']['openid'] = $value['openid'];
230
231
            $resultArray['cardList'][$key]['cardExt']['timestamp'] = $timestamp;
232
            $resultArray['cardList'][$key]['cardExt']['signature'] = $string;
233
234
            if (!empty($value['outer_id'])) {
235
                $resultArray['cardList'][$key]['cardExt']['outer_id'] = $value['outer_id'];
236
            }
237
238
            $resultArray['cardList'][$key]['cardExt'] = json_encode($resultArray['cardList'][$key]['cardExt']);
239
        }
240
241
        $resultJson = json_encode($resultArray);
242
243
        return $resultJson;
244
    }
245
246
    /**
247
     * 创建货架接口
248
     *
249
     * @param $banner
250
     * @param $page_title
251
     * @param $can_share
252
     * @param $scene
253
     * @param $card_list
254
     *
255
     * @return array
256
     */
257
    public function landingPage($banner, $page_title, $can_share, $scene, $card_list)
258
    {
259
        $params = [
260
            'banner'     => $banner,
261
            'page_title' => $page_title,
262
            'can_share'  => $can_share,
263
            'scene'      => $scene,
264
            'card_list'  => $card_list,
265
        ];
266
267
        return $this->parseJSON('json', [self::API_LANDING_PAGE, $params]);
268
    }
269
270
    /**
271
     * 导入code接口
272
     *
273
     * @param $card_id
274
     * @param $code
275
     *
276
     * @return array
277
     */
278 View Code Duplication
    public function deposit($card_id, $code)
279
    {
280
        $params = [
281
            'card_id' => $card_id,
282
            'code'    => $code,
283
        ];
284
285
        return $this->parseJSON('json', [self::API_DEPOSIT, $params]);
286
    }
287
288
    /**
289
     * 查询导入code数目
290
     *
291
     * @param $card_id
292
     *
293
     * @return array
294
     */
295 View Code Duplication
    public function getDepositCount($card_id)
296
    {
297
        $params = [
298
            'card_id' => $card_id,
299
        ];
300
301
        return $this->parseJSON('json', [self::API_GET_DEPOSIT_COUNT, $params]);
302
    }
303
304
    /**
305
     * 核查code接口
306
     *
307
     * @param $card_id
308
     * @param $code
309
     *
310
     * @return array
311
     */
312 View Code Duplication
    public function checkCode($card_id, $code)
313
    {
314
        $params = [
315
            'card_id' => $card_id,
316
            'code'    => $code,
317
        ];
318
319
        return $this->parseJSON('json', [self::API_CHECK_CODE, $params]);
320
    }
321
322
    /**
323
     * 图文消息群发卡券
324
     *
325
     * @param $card_id
326
     *
327
     * @return array
328
     */
329 View Code Duplication
    public function getHtml($card_id)
330
    {
331
        $params = [
332
            'card_id' => $card_id,
333
        ];
334
335
        return $this->parseJSON('json', [self::API_GET_HTML, $params]);
336
    }
337
338
    /**
339
     * 设置测试白名单
340
     *
341
     * @param $openid
342
     * @param $username
343
     *
344
     * @return array
345
     */
346
    public function testWhiteList($openid, $username)
347
    {
348
        $params = [
349
            'openid'   => $openid,
350
            'username' => $username,
351
        ];
352
353
        return $this->parseJSON('json', [self::API_TEST_WHITE_LIST, $params]);
354
    }
355
356
    /**
357
     * 查询Code接口
358
     *
359
     * @param $code
360
     * @param $check_consume
361
     * @param $card_id
362
     *
363
     * @return array
364
     */
365
    public function codeGet($code, $check_consume, $card_id)
366
    {
367
        $params = [
368
            'code'          => $code,
369
            'check_consume' => $check_consume,
370
            'card_id'       => $card_id,
371
        ];
372
373
        return $this->parseJSON('json', [self::API_CODE_GET, $params]);
374
    }
375
376
    /**
377
     * 核销Code接口
378
     *
379
     * @param $card_id
380
     * @param $code
381
     *
382
     * @return array
383
     */
384
    public function consume($card_id, $code)
385
    {
386
        $params = [
387
            'card_id' => $card_id,
388
            'code'    => $code,
389
        ];
390
391
        return $this->parseJSON('json', [self::API_CONSUME, $params]);
392
    }
393
394
    /**
395
     * Code解码接口
396
     *
397
     * @param $encrypt_code
398
     *
399
     * @return array
400
     */
401 View Code Duplication
    public function decrypt($encrypt_code)
402
    {
403
        $params = [
404
            'encrypt_code' => $encrypt_code,
405
        ];
406
407
        return $this->parseJSON('json', [self::API_DECRYPT, $params]);
408
    }
409
410
    /**
411
     * 获取用户已领取卡券接口
412
     *
413
     * @param        $openid
414
     * @param string $card_id
415
     *
416
     * @return array
417
     */
418
    public function getCardList($openid, $card_id = '')
419
    {
420
        $params = [
421
            'openid'  => $openid,
422
            'card_id' => $card_id,
423
        ];
424
425
        return $this->parseJSON('json', [self::API_GET_CARD_LIST, $params]);
426
    }
427
428
    /**
429
     * 查看卡券详情
430
     *
431
     * @param $card_id
432
     *
433
     * @return array
434
     */
435
    public function cardGet($card_id)
436
    {
437
        $params = [
438
            'card_id' => $card_id,
439
        ];
440
441
        return $this->parseJSON('json', [self::API_CARD_GET, $params]);
442
    }
443
444
    /**
445
     * 批量查询卡列表
446
     *
447
     * @param int    $offset
448
     * @param int    $count
449
     * @param string $status_list
450
     *
451
     * @return array
452
     */
453 View Code Duplication
    public function batchGet($offset = 0, $count = 10, $status_list = 'CARD_STATUS_VERIFY_OK')
454
    {
455
        $params = [
456
            'offset'      => $offset,
457
            'count'       => $count,
458
            'status_list' => $status_list,
459
        ];
460
461
        return $this->parseJSON('json', [self::API_BATCH_GET, $params]);
462
    }
463
464
    /**
465
     * 更改卡券信息接口 and 设置跟随推荐接口
466
     *
467
     * @param       $card_id
468
     * @param       $type
469
     * @param array $base_info
470
     * @param array $especial
471
     *
472
     * @return array
473
     */
474
    public function update($card_id, $type, $base_info = [], $especial = [])
475
    {
476
        $card            = [];
477
        $card['card_id'] = $card_id;
478
        $card[$type]     = [];
479
480
        $card_info              = [];
481
        $card_info['base_info'] = $base_info;
482
483
        $card[$type] = array_merge($card_info, $especial);
484
485
        return $this->parseJSON('json', [self::API_UPDATE, $card]);
486
    }
487
488
    /**
489
     * 设置微信买单接口
490
     * 设置买单的card_id必须已经配置了门店,否则会报错
491
     *
492
     * @param      $card_id
493
     * @param bool $is_open
494
     *
495
     * @return array
496
     */
497
    public function payCellSet($card_id, $is_open = true)
498
    {
499
        $params = [
500
            'card_id' => $card_id,
501
            'is_open' => $is_open,
502
        ];
503
504
        return $this->parseJSON('json', [self::API_PAY_CELL_SET, $params]);
505
    }
506
507
    /**
508
     * 修改库存接口
509
     *
510
     * @param        $card_id
511
     * @param string $stock
512
     * @param int    $value
513
     *
514
     * @return array
515
     */
516
    public function modifyStock($card_id, $stock = 'increase', $value = 0)
517
    {
518
        $params            = [];
519
        $params['card_id'] = $card_id;
520
        if ($stock == 'increase') {
521
            $params['increase_stock_value'] = intval($value);
522
        } elseif ($stock == 'reduce') {
523
            $params['reduce_stock_value'] = intval($value);
524
        } else {
525
            return false;
526
        }
527
528
        return $this->parseJSON('json', [self::API_MODIFY_STOCK, $params]);
529
    }
530
531
    /**
532
     * 更改Code接口
533
     *
534
     * @param       $code
535
     * @param       $new_code
536
     * @param array $card_id
537
     *
538
     * @return array
539
     */
540
    public function codeUpdate($code, $new_code, $card_id = [])
541
    {
542
        $params = [
543
            'code'     => $code,
544
            'new_code' => $new_code,
545
            'card_id'  => $card_id,
546
        ];
547
548
        return $this->parseJSON('json', [self::API_CODE_UPDATE, $params]);
549
    }
550
551
    /**
552
     * 删除卡券接口
553
     *
554
     * @param $card_id
555
     *
556
     * @return array
557
     */
558
    public function cardDelete($card_id)
559
    {
560
        $params = [
561
            'card_id' => $card_id,
562
        ];
563
564
        return $this->parseJSON('json', [self::API_CARD_DELETE, $params]);
565
    }
566
567
    /**
568
     * 设置卡券失效
569
     *
570
     * @param      $code
571
     * @param null $card_id
572
     *
573
     * @return array
574
     */
575
    public function unavailable($code, $card_id = null)
576
    {
577
        $params = [
578
            'code'    => $code,
579
            'card_id' => $card_id,
580
        ];
581
582
        return $this->parseJSON('json', [self::API_UNAVAILABLE, $params]);
583
    }
584
585
    /**
586
     * 拉取卡券概况数据接口
587
     *
588
     * @param     $begin_date
589
     * @param     $end_date
590
     * @param int $cond_source
591
     *
592
     * @return array
593
     */
594
    public function getCardBizUinInfo($begin_date, $end_date, $cond_source = 0)
595
    {
596
        if (is_numeric($begin_date)) {
597
            $begin_date = date('Y-m-d', $begin_date);
598
        }
599
600
        if (is_numeric($end_date)) {
601
            $end_date = date('Y-m-d', $end_date);
602
        }
603
604
        $params = [
605
            'begin_date'  => $begin_date,
606
            'end_date'    => $end_date,
607
            'cond_source' => intval($cond_source),
608
        ];
609
610
        return $this->parseJSON('json', [self::API_CARD_BIZ_UIN_INFO, $params]);
611
    }
612
613
    /**
614
     * 获取免费券数据接口
615
     *
616
     * @param        $begin_date
617
     * @param        $end_date
618
     * @param int    $cond_source
619
     * @param string $card_id
620
     *
621
     * @return array
622
     */
623 View Code Duplication
    public function getCardCardInfo($begin_date, $end_date, $cond_source = 0, $card_id = '')
624
    {
625
        $params = [
626
            'begin_date'  => $begin_date,
627
            'end_date'    => $end_date,
628
            'cond_source' => intval($cond_source),
629
            'card_id'     => $card_id,
630
        ];
631
632
        return $this->parseJSON('json', [self::API_CARD_CARD_INFO, $params]);
633
    }
634
635
    /**
636
     * 拉取会员卡数据接口
637
     *
638
     * @param     $begin_date
639
     * @param     $end_date
640
     * @param int $cond_source
641
     *
642
     * @return array
643
     */
644 View Code Duplication
    public function getCardMemberCardInfo($begin_date, $end_date, $cond_source = 0)
645
    {
646
        $params = [
647
            'begin_date'  => $begin_date,
648
            'end_date'    => $end_date,
649
            'cond_source' => intval($cond_source),
650
        ];
651
652
        return $this->parseJSON('json', [self::API_CARD_MEMBER_CARD_INFO, $params]);
653
    }
654
655
    /**
656
     * 会员卡接口激活
657
     *
658
     * @param array $activate
659
     *
660
     * @return array
661
     */
662
    public function activate($activate = [])
663
    {
664
        return $this->parseJSON('json', [self::API_CARD_ACTIVATE, $activate]);
665
    }
666
667
    /**
668
     * 设置开卡字段接口
669
     *
670
     * @param       $card_id
671
     * @param array $required_form
672
     * @param array $optional_form
673
     *
674
     * @return array
675
     */
676
    public function activateUserFrom($card_id, $required_form = [], $optional_form = [])
677
    {
678
        $card            = [];
679
        $card['card_id'] = $card_id;
680
681
        $params = array_merge($card, $required_form, $optional_form);
682
683
        return $this->parseJSON('json', [self::API_ACTIVATE_USER_FORM, $params]);
684
    }
685
686
    /**
687
     * 拉取会员信息接口
688
     *
689
     * @param $card_id
690
     * @param $code
691
     *
692
     * @return array
693
     */
694
    public function memberCardUserInfo($card_id, $code)
695
    {
696
        $params = [
697
            'card_id' => $card_id,
698
            'code'    => $code,
699
        ];
700
701
        return $this->parseJSON('json', [self::API_MEMBER_USER_INFO, $params]);
702
    }
703
704
    /**
705
     * 更新会员信息
706
     *
707
     * @param array $updateUser
708
     *
709
     * @return array
710
     */
711
    public function memberCardUpdateUser($updateUser = [])
712
    {
713
        $params = $updateUser;
714
715
        return $this->parseJSON('json', [self::API_UPDATE_USER, $params]);
716
    }
717
718
    /**
719
     * 添加子商户
720
     *
721
     * @param        $brand_name
722
     * @param        $logo_url
723
     * @param        $protocol
724
     * @param        $end_time
725
     * @param        $primary_category_id
726
     * @param        $secondary_category_id
727
     * @param        $agreement_media_id
728
     * @param        $operator_media_id
729
     * @param string $app_id
730
     *
731
     * @return array
732
     */
733
    public function subMerchant($brand_name, $logo_url, $protocol, $end_time, $primary_category_id, $secondary_category_id, $agreement_media_id, $operator_media_id, $app_id = '')
734
    {
735
        $params = [
736
            'info' => [
737
                'brand_name'            => $brand_name,
738
                'logo_url'              => $logo_url,
739
                'protocol'              => $protocol,
740
                'end_time'              => $end_time,
741
                'primary_category_id'   => $primary_category_id,
742
                'secondary_category_id' => $secondary_category_id,
743
                'agreement_media_id'    => $agreement_media_id,
744
                'operator_media_id'     => $operator_media_id,
745
                'app_id'                => $app_id,
746
            ],
747
        ];
748
749
        return $this->parseJSON('json', [self::API_SUB_MERCHANT, $params]);
750
    }
751
752
    /**
753
     * 卡券开放类目查询接口
754
     *
755
     * @return array|bool
756
     */
757
    public function getApplyProtocol()
758
    {
759
        return $this->parseJSON('get', [self::API_GET_APPLY_PROTOCOL]);
760
    }
761
762
    /**
763
     * Set cache manager.
764
     *
765
     * @param \Doctrine\Common\Cache\Cache $cache
766
     *
767
     * @return $this
768
     */
769
    public function setCache(Cache $cache)
770
    {
771
        $this->cache = $cache;
772
773
        return $this;
774
    }
775
776
    /**
777
     * Return cache manager.
778
     *
779
     * @return \Doctrine\Common\Cache\Cache
780
     */
781
    public function getCache()
782
    {
783
        return $this->cache ?: $this->cache = new FilesystemCache(sys_get_temp_dir());
784
    }
785
}
786