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.
Completed
Push — master ( 1144b4...828920 )
by Márk
07:09 queued 04:40
created

Driver::popMessage()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 2
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
    public function listQueues()
18
    {
19
        return array_keys($this->queues);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function createQueue($queueName)
26
    {
27
        if (!array_key_exists($queueName, $this->queues)) {
28
            $this->queues[$queueName] = [];
29
        }
30
    }
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