Completed
Push — master ( 025867...be698f )
by mingyoung
04:24 queued 10s
created

Client   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A session() 0 8 1
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
namespace EasyWeChat\Work\MiniProgram\Auth;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 */
19
class Client extends BaseClient
20
{
21
    /**
22
     * Get session info by code.
23
     *
24
     * @param string $code
25
     *
26
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
27
     *
28
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
29
     */
30
    public function session(string $code)
31
    {
32
        $params = [
33
            'js_code' => $code,
34
            'grant_type' => 'authorization_code',
35
        ];
36
37
        return $this->httpGet('cgi-bin/miniprogram/jscode2session', $params);
38
    }
39
}
40