ConfigExtractor   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A extract() 0 23 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zored\Telegram\Madeline\Config\Extractor;
6
7
use danog\MadelineProto\Logger;
8
use Zored\Telegram\Madeline\Config\ConfigInterface;
9
10
class ConfigExtractor implements ConfigExtractorInterface
11
{
12
    public function extract(ConfigInterface $config): array
13
    {
14
        /*
15
         * @see https://docs.madelineproto.xyz/FULL_README.html#settings
16
         */
17
        return [
18
            'app_info' => [
19
                'api_id' => $config->getId(),
20
                'api_hash' => $config->getHash(),
21
            ],
22
            'logger' => [
23
                'logger' => $config->getLogLevel(),
24
                'logger_level' => Logger::VERBOSE,
25
            ],
26
            'authorization' => [
27
                'default_temp_auth_key_expires_in' => $config->getAuthExpiresInSeconds(),
28
            ],
29
            'updates' => [
30
                'handle_updates' => $config->getAuth()->isHandleUpdates(),
31
            ],
32
            'connection_settings' => [
33
                'all' => [
34
                    'pfs' => false,
35
                ],
36
            ],
37
        ];
38
    }
39
}
40