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.

Driver::createQueue()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0185
1
<?php
2
3
namespace Bernard\Driver\InMemory;
4
5
/**
6
 * Simple in-memory driver.
7
 *
8
 * @author Márk Sági-Kazár <[email protected]>
9
 */
10
final class Driver implements \Bernard\Driver
11
{
12
    private $queues = [];
13
14
    /**
15
     * {@inheritdoc}
16
     */
17 1
    public function listQueues()
18
    {
19 1
        return array_keys($this->queues);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function createQueue($queueName)
26
    {
27 1
        if (!array_key_exists($queueName, $this->queues)) {
28 1
            $this->queues[$queueName] = [];
29 1
        }
30 1
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function countMessages($queueName)
36
    {
37
        if (array_key_exists($queueName, $this->queues)) {
38
            return count($this->queues[$queueName]);
39
        }
40
41
        return 0;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function pushMessage($queueName, $message)
48
    {
49
        $this->queues[$queueName][] = $message;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function popMessage($queueName, $duration = 5)
56
    {
57
        if (!array_key_exists($queueName, $this->queues) || count($this->queues[$queueName]) < 1) {
58
            return [null, null];
59
        }
60
61
        return [array_shift($this->queues[$queueName]), null];
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function acknowledgeMessage($queueName, $receipt)
68
    {
69
        // Noop
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function peekQueue($queueName, $index = 0, $limit = 20)
76
    {
77
        if (array_key_exists($queueName, $this->queues)) {
78
            return array_slice($this->queues[$queueName], $index, $limit);
79
        }
80
81
        return null;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function removeQueue($queueName)
88
    {
89
        if (array_key_exists($queueName, $this->queues)) {
90
            unset($this->queues[$queueName]);
91
        }
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97
    public function info()
98
    {
99
        return [];
100
    }
101
}
102