|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the mingyoung/dingtalk. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 张铭阳 <[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 EasyDingTalk; |
|
13
|
|
|
|
|
14
|
|
|
use Overtrue\Http\Support\Collection; |
|
15
|
|
|
use Pimple\Container; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @property \EasyDingTalk\Auth\SsoClient $sso |
|
19
|
|
|
* @property \EasyDingTalk\Auth\OAuthClient $oauth |
|
20
|
|
|
* @property \EasyDingTalk\Chat\Client $chat |
|
21
|
|
|
* @property \EasyDingTalk\Role\Client $role |
|
22
|
|
|
* @property \EasyDingTalk\User\Client $user |
|
23
|
|
|
* @property \EasyDingTalk\Media\Client $media |
|
24
|
|
|
* @property \EasyDingTalk\H5app\Client $h5app |
|
25
|
|
|
* @property \EasyDingTalk\Health\Client $health |
|
26
|
|
|
* @property \EasyDingTalk\Report\Client $report |
|
27
|
|
|
* @property \EasyDingTalk\Checkin\Client $checkin |
|
28
|
|
|
* @property \EasyDingTalk\Contact\Client $contact |
|
29
|
|
|
* @property \EasyDingTalk\Process\Client $process |
|
30
|
|
|
* @property \EasyDingTalk\Calendar\Client $calendar |
|
31
|
|
|
* @property \EasyDingTalk\Callback\Client $callback |
|
32
|
|
|
* @property \EasyDingTalk\Microapp\Client $microapp |
|
33
|
|
|
* @property \EasyDingTalk\Schedule\Client $schedule |
|
34
|
|
|
* @property \EasyDingTalk\Blackboard\Client $blackboard |
|
35
|
|
|
* @property \EasyDingTalk\Attendance\Client $attendance |
|
36
|
|
|
* @property \EasyDingTalk\Department\Client $department |
|
37
|
|
|
* @property \EasyDingTalk\Conversation\Client $conversation |
|
38
|
|
|
* @property \EasyDingTalk\Kernel\Http\Client $client |
|
39
|
|
|
* @property \Monolog\Logger $logger |
|
40
|
|
|
* @property \EasyDingTalk\Kernel\Server $server |
|
41
|
|
|
* @property \Symfony\Component\HttpFoundation\Request $request |
|
42
|
|
|
* @property \EasyDingTalk\Kernel\Encryption\Encryptor $encryptor |
|
43
|
|
|
* @property \EasyDingTalk\Kernel\AccessToken $access_token |
|
44
|
|
|
*/ |
|
45
|
|
|
class Application extends Container |
|
46
|
|
|
{ |
|
47
|
|
|
/** |
|
48
|
|
|
* @var array |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $providers = [ |
|
51
|
|
|
Auth\ServiceProvider::class, |
|
52
|
|
|
Chat\ServiceProvider::class, |
|
53
|
|
|
Role\ServiceProvider::class, |
|
54
|
|
|
User\ServiceProvider::class, |
|
55
|
|
|
Media\ServiceProvider::class, |
|
56
|
|
|
H5app\ServiceProvider::class, |
|
57
|
|
|
Health\ServiceProvider::class, |
|
58
|
|
|
Report\ServiceProvider::class, |
|
59
|
|
|
Checkin\ServiceProvider::class, |
|
60
|
|
|
Contact\ServiceProvider::class, |
|
61
|
|
|
Process\ServiceProvider::class, |
|
62
|
|
|
Calendar\ServiceProvider::class, |
|
63
|
|
|
Callback\ServiceProvider::class, |
|
64
|
|
|
Microapp\ServiceProvider::class, |
|
65
|
|
|
Schedule\ServiceProvider::class, |
|
66
|
|
|
Blackboard\ServiceProvider::class, |
|
67
|
|
|
Attendance\ServiceProvider::class, |
|
68
|
|
|
Department\ServiceProvider::class, |
|
69
|
|
|
Conversation\ServiceProvider::class, |
|
70
|
|
|
Kernel\Providers\ClientServiceProvider::class, |
|
71
|
|
|
Kernel\Providers\LoggerServiceProvider::class, |
|
72
|
|
|
Kernel\Providers\ServerServiceProvider::class, |
|
73
|
|
|
Kernel\Providers\RequestServiceProvider::class, |
|
74
|
|
|
Kernel\Providers\EncryptionServiceProvider::class, |
|
75
|
|
|
Kernel\Providers\AccessTokenServiceProvider::class, |
|
76
|
|
|
]; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Application constructor. |
|
80
|
|
|
* |
|
81
|
|
|
* @param array $config |
|
82
|
|
|
* @param array $values |
|
83
|
|
|
*/ |
|
84
|
|
|
public function __construct($config = [], array $values = []) |
|
85
|
|
|
{ |
|
86
|
|
|
parent::__construct($values); |
|
87
|
|
|
|
|
88
|
|
|
$this['config'] = function () use ($config) { |
|
89
|
|
|
return new Collection($config); |
|
90
|
|
|
}; |
|
91
|
|
|
|
|
92
|
|
|
foreach ($this->providers as $provider) { |
|
93
|
|
|
$this->register(new $provider()); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @param $name |
|
99
|
|
|
* |
|
100
|
|
|
* @return mixed |
|
101
|
|
|
*/ |
|
102
|
|
|
public function __get($name) |
|
103
|
|
|
{ |
|
104
|
|
|
return $this[$name]; |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|