StockTickerConfig   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 8
dl 0
loc 40
ccs 0
cts 15
cp 0
rs 10
c 1
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getSlackBotUserOauthAccessToken() 0 3 1
A isTrue() 0 3 1
A getTemplatesDir() 0 3 1
A getMailerPassword() 0 3 1
A getMailerUsername() 0 3 1
A isDebug() 0 3 1
A getSlackDestinyChannelId() 0 3 1
A getToAddress() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTicker;
6
7
use Gacela\Framework\AbstractConfig;
8
9
use function dirname;
10
use function in_array;
11
12
final class StockTickerConfig extends AbstractConfig
13
{
14
    public function getTemplatesDir(): string
15
    {
16
        return dirname(__DIR__) . '/notification';
17
    }
18
19
    public function getToAddress(): string
20
    {
21
        return (string) $this->get('TO_ADDRESS');
22
    }
23
24
    public function getMailerUsername(): string
25
    {
26
        return (string) $this->get('MAILER_USERNAME');
27
    }
28
29
    public function getMailerPassword(): string
30
    {
31
        return (string) $this->get('MAILER_PASSWORD');
32
    }
33
34
    public function getSlackDestinyChannelId(): string
35
    {
36
        return (string) $this->get('SLACK_DESTINY_CHANNEL_ID');
37
    }
38
39
    public function getSlackBotUserOauthAccessToken(): string
40
    {
41
        return (string) $this->get('SLACK_BOT_USER_OAUTH_ACCESS_TOKEN');
42
    }
43
44
    public function isDebug(): bool
45
    {
46
        return $this->isTrue((string) $this->get('DEBUG'));
47
    }
48
49
    private function isTrue(string $bool): bool
50
    {
51
        return in_array($bool, ['true', '1', 'yes'], true);
52
    }
53
}
54