1 | <?php |
||
10 | class ApiClient extends Client |
||
11 | { |
||
12 | /** |
||
13 | * @param array $config |
||
14 | */ |
||
15 | 3 | public function __construct($config = []) |
|
16 | { |
||
17 | 3 | $config = Collection::fromConfig($config, [], ['token']); |
|
18 | 3 | parent::__construct('', $config); |
|
19 | |||
20 | 3 | $description = ServiceDescription::factory(__DIR__.'/Resources/slack_api.json'); |
|
21 | 3 | $this->setDescription($description); |
|
22 | |||
23 | 3 | $this->getEventDispatcher()->addListener('command.before_prepare', function (Event $event) use ($config) { |
|
24 | 1 | $event['command']['token'] = $config['token']; |
|
25 | 3 | }); |
|
26 | 3 | } |
|
27 | |||
28 | /** |
||
29 | * @param array $config |
||
30 | * |
||
31 | * @return ApiClient |
||
32 | */ |
||
33 | 1 | public static function factory($config = []) |
|
37 | } |
||
38 |