Completed
Push — master ( 2addb1...4d5931 )
by Carlos
08:01 queued 02:29
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

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\Guard    $server
22
 * @property \EasyWeChat\OpenWork\Corp\Client     $corp
23
 * @property \EasyWeChat\OpenWork\Provider\Client $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
     * @param string $authCorpId    企业 corp_id
50
     * @param string $permanentCode 企业永久授权码
51
     *
52
     * @return Work
53
     */
54
    public function work(string $authCorpId, string $permanentCode): Work
55
    {
56
        return new Work($authCorpId, $permanentCode, $this);
57
    }
58
59
    /**
60
     * @param string $method
61
     * @param array  $arguments
62
     *
63
     * @return mixed
64
     */
65
    public function __call($method, $arguments)
66
    {
67
        return $this['base']->$method(...$arguments);
68
    }
69
}
70