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 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Bernard\Driver\Pheanstalk;
4
5
use Pheanstalk\PheanstalkInterface;
6
7
/**
8
 * Implements a Driver for use with https://github.com/pda/pheanstalk.
9
 */
10
final class Driver implements \Bernard\Driver
11
{
12
    private $pheanstalk;
13
14
    /**
15
     * @param PheanstalkInterface $pheanstalk
16
     */
17 8
    public function __construct(PheanstalkInterface $pheanstalk)
18
    {
19 8
        $this->pheanstalk = $pheanstalk;
20 8
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function listQueues()
26
    {
27 1
        return $this->pheanstalk->listTubes();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function createQueue($queueName)
34
    {
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function countMessages($queueName)
41
    {
42 1
        $stats = $this->pheanstalk->statsTube($queueName);
43
44 1
        return $stats['current-jobs-ready'];
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 1
    public function pushMessage($queueName, $message)
51
    {
52 1
        $this->pheanstalk->putInTube($queueName, $message);
53 1
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 1
    public function popMessage($queueName, $duration = 5)
59
    {
60 1
        if ($job = $this->pheanstalk->reserveFromTube($queueName, $duration)) {
61 1
            return [$job->getData(), $job];
62
        }
63
64 1
        return [null, null];
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70 1
    public function acknowledgeMessage($queueName, $receipt)
71
    {
72 1
        $this->pheanstalk->delete($receipt);
73 1
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78 1
    public function peekQueue($queueName, $index = 0, $limit = 20)
79
    {
80 1
        return [];
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function removeQueue($queueName)
87
    {
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93 1
    public function info()
94
    {
95 1
        return $this->pheanstalk
96 1
            ->stats()
97 1
            ->getArrayCopy()
98 1
        ;
99
    }
100
}
101