Completed
Pull Request — master (#1275)
by
unknown
03:05
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A work() 0 3 1
A __call() 0 3 1
1
<?php
2
/*
3
 * This file is part of the keacefull/wechat.
4
 *
5
 * (c) xiaomin <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace EasyWeChat\OpenWork;
12
13
use EasyWeChat\Kernel\ServiceContainer;
14
use EasyWeChat\OpenWork\Work\Application as Work;
15
16
/**
17
 * Class Application
18
 * @package EasyWeChat\OpenWork
19
 *
20
 * @author Xiaomin<[email protected]>
21
 *
22
 * //配置文件格式
23
 * $config = [
24
 *      'corp_id'         => 'XXX', //服务商的corpid
25
 *      'secret'          => 'XXX', //服务商的secret,在服务商管理后台可见
26
 *      'suite_id'        => 'XXX', //应用的suiteID
27
 *      'suite_secret'    => 'XXX',//应用的Secret
28
 *      'token'           => 'XXX', //应用的token
29
 *      'aes_key'         => 'XXX',//应用的aes_key
30
 *      'reg_template_id' => '注册定制化模板ID',
31
 * ];
32
 *
33
 * @property \EasyWeChat\OpenWork\Server\ServiceProvider $server
34
 * @property \EasyWeChat\OpenWork\Corp\ServiceProvider $corp
35
 * @property \EasyWeChat\OpenWork\Provider\ServiceProvider $provider
36
 *
37
 */
38
class Application extends ServiceContainer
39
{
40
41
    /**
42
     * @var array
43
     */
44
    protected $providers = [
45
        Auth\ServiceProvider::class,
46
        SuiteAuth\ServiceProvider::class,
47
        Server\ServiceProvider::class,
48
        Corp\ServiceProvider::class,
49
        Provider\ServiceProvider::class,
50
    ];
51
52
    /**
53
     * @var array
54
     */
55
    protected $defaultConfig = [
56
        // http://docs.guzzlephp.org/en/stable/request-options.html
57
        'http' => [
58
            'base_uri' => 'https://qyapi.weixin.qq.com/',
59
        ],
60
    ];
61
62
63
    /**
64
     * @param string $auth_corpid 企业 corp_id
65
     * @param string $permanent_code 企业永久授权码
66
     * @return Work
67
     */
68
    public function work(string $auth_corpid, string $permanent_code): Work
69
    {
70
        return new Work($auth_corpid, $permanent_code, $this);
71
    }
72
73
74
    /**
75
     * @param string $method
76
     * @param array $arguments
77
     *
78
     * @return mixed
79
     */
80
    public function __call($method, $arguments)
81
    {
82
        return $this['base']->$method(...$arguments);
83
    }
84
}