Completed
Pull Request — master (#1277)
by
unknown
03:17
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 overtrue/wechat.
4
 *
5
 * (c) overtrue <[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
 * Application.
18
 *
19
 * @author xiaomin <[email protected]>
20
 *
21
 * @property \EasyWeChat\OpenWork\Server\ServiceProvider   $server
22
 * @property \EasyWeChat\OpenWork\Corp\ServiceProvider     $corp
23
 * @property \EasyWeChat\OpenWork\Provider\ServiceProvider $provider
24
 */
25
class Application extends ServiceContainer
26
{
27
    /**
28
     * @var array
29
     */
30
    protected $providers = [
31
        Auth\ServiceProvider::class,
32
        SuiteAuth\ServiceProvider::class,
33
        Server\ServiceProvider::class,
34
        Corp\ServiceProvider::class,
35
        Provider\ServiceProvider::class,
36
    ];
37
38
    /**
39
     * @var array
40
     */
41
    protected $defaultConfig = [
42
        // http://docs.guzzlephp.org/en/stable/request-options.html
43
        'http' => [
44
            'base_uri' => 'https://qyapi.weixin.qq.com/',
45
        ],
46
    ];
47
48
49
    /**
50
     * @param string $auth_corpid    企业 corp_id
51
     * @param string $permanent_code 企业永久授权码
52
     *
53
     * @return Work
54
     */
55
    public function work(string $auth_corpid, string $permanent_code): Work
56
    {
57
        return new Work($auth_corpid, $permanent_code, $this);
58
    }
59
60
61
    /**
62
     * @param string $method
63
     * @param array  $arguments
64
     *
65
     * @return mixed
66
     */
67
    public function __call($method, $arguments)
68
    {
69
        return $this['base']->$method(...$arguments);
70
    }
71
72
}