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 (#5)
by Jeroen van
06:43
created

ConfigReader::getTimeout()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

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