GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#10)
by
unknown
04:43
created

ConfigReader::getPhpPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Webparking\QueueEnsurer\Config;
4
5
class ConfigReader
6
{
7 7
    public function getQueueNames(): array
8
    {
9 7
        return array_keys(config('queue-ensurer.queues'));
10
    }
11
12 6
    public function getAmount(string $queueName): int
13
    {
14 6
        $queueConfig = $this->getQueueConfig($queueName);
15
16 6
        if (\is_array($queueConfig)) {
17 1
            return $queueConfig['amount'];
18
        }
19
20 5
        return $queueConfig;
21
    }
22
23 3
    public function getPhpPath(): string
24
    {
25 3
        return config('queue-ensurer.php-path', 'php');
26
    }
27
28 3
    public function getConnection(string $queueName): ?string
29
    {
30 3
        $queueConfig = $this->getQueueConfig($queueName);
31
32 3
        if (\is_array($queueConfig) && \array_key_exists('connection', $queueConfig)) {
33 1
            return $queueConfig['connection'];
34
        }
35
36 2
        return null;
37
    }
38
39 3
    public function specifyQueue(string $queueName): bool
40
    {
41 3
        $queueConfig = $this->getQueueConfig($queueName);
42
43 3
        if (\is_array($queueConfig) && \array_key_exists('specify-queue', $queueConfig)) {
44 1
            return $queueConfig['specify-queue'];
45
        }
46
47 2
        return config('queue-ensurer.defaults.specify-queue');
48
    }
49
50 3
    public function getTimeout(string $queueName): int
51
    {
52 3
        $queueConfig = $this->getQueueConfig($queueName);
53
54 3
        if (\is_array($queueConfig) && \array_key_exists('timeout', $queueConfig)) {
55 1
            return $queueConfig['timeout'];
56
        }
57
58 2
        return config('queue-ensurer.defaults.timeout');
59
    }
60
61 3
    public function getSleep(string $queueName): int
62
    {
63 3
        $queueConfig = $this->getQueueConfig($queueName);
64
65 3
        if (\is_array($queueConfig) && \array_key_exists('sleep', $queueConfig)) {
66 1
            return $queueConfig['sleep'];
67
        }
68
69 2
        return config('queue-ensurer.defaults.sleep');
70
    }
71
72 3
    public function getTries(string $queueName): int
73
    {
74 3
        $queueConfig = $this->getQueueConfig($queueName);
75
76 3
        if (\is_array($queueConfig) && \array_key_exists('tries', $queueConfig)) {
77 1
            return $queueConfig['tries'];
78
        }
79
80 2
        return config('queue-ensurer.defaults.tries');
81
    }
82
83
    /**
84
     * @return array|int
85
     */
86 6
    private function getQueueConfig(string $queueName)
87
    {
88 6
        return config('queue-ensurer.queues')[$queueName];
89
    }
90
}
91