StockTickerConfig::getSlackDestinyChannelId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 1
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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