Config   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

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

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getLogLevel() 0 3 1
A setAuthExpiresInSeconds() 0 5 1
A __construct() 0 10 1
A getHash() 0 3 1
A getSessionPath() 0 3 1
A getAuth() 0 3 1
A getAuthExpiresInSeconds() 0 3 1
A setLogLevel() 0 5 1
A setSessionPath() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zored\Telegram\Madeline\Config;
6
7
use JMS\Serializer\Annotation as Serializer;
8
use Zored\Telegram\Madeline\Config\Auth\AuthConfigInterface;
9
10
class Config implements ConfigInterface
11
{
12
    /**
13
     * @Serializer\Type("integer")
14
     *
15
     * @var int
16
     */
17
    private $id;
18
19
    /**
20
     * @Serializer\Type("string")
21
     *
22
     * @var string
23
     */
24
    private $hash;
25
26
    /**
27
     * @Serializer\Type("integer")
28
     *
29
     * @var int
30
     */
31
    private $logLevel = LogLevel::NONE;
32
33
    /**
34
     * @Serializer\Type("integer")
35
     * Default: one day.
36
     *
37
     * @var int
38
     */
39
    private $authExpiresInSeconds = 86400;
40
41
    /**
42
     * @Serializer\Type("string")
43
     *
44
     * @var string
45
     */
46
    private $sessionPath;
47
48
    /**
49
     * @var AuthConfigInterface
50
     */
51
    private $auth;
52
53
    public function __construct(
54
        int $id,
55
        string $hash,
56
        AuthConfigInterface $auth,
57
        string $sessionPath
58
    ) {
59
        $this->id = $id;
60
        $this->hash = $hash;
61
        $this->sessionPath = $sessionPath;
62
        $this->auth = $auth;
63
    }
64
65
    public function setLogLevel(int $logLevel): ConfigInterface
66
    {
67
        $this->logLevel = $logLevel;
68
69
        return $this;
70
    }
71
72
    public function setAuthExpiresInSeconds(int $authExpiresInSeconds): ConfigInterface
73
    {
74
        $this->authExpiresInSeconds = $authExpiresInSeconds;
75
76
        return $this;
77
    }
78
79
    public function getId(): int
80
    {
81
        return $this->id;
82
    }
83
84
    public function getHash(): string
85
    {
86
        return $this->hash;
87
    }
88
89
    public function getLogLevel(): int
90
    {
91
        return $this->logLevel;
92
    }
93
94
    public function getAuthExpiresInSeconds(): int
95
    {
96
        return $this->authExpiresInSeconds;
97
    }
98
99
    public function getSessionPath(): string
100
    {
101
        return $this->sessionPath;
102
    }
103
104
    public function setSessionPath(string $sessionPath): ConfigInterface
105
    {
106
        $this->sessionPath = $sessionPath;
107
108
        return $this;
109
    }
110
111
    public function getAuth(): AuthConfigInterface
112
    {
113
        return $this->auth;
114
    }
115
}
116