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.

AbstractQueue::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1.0156
1
<?php
2
3
namespace Bernard\Queue;
4
5
use Bernard\Envelope;
6
use Bernard\Exception\InvalidOperationException;
7
8
abstract class AbstractQueue implements \Bernard\Queue
9
{
10
    protected $closed;
11
    protected $name;
12
13
    /**
14
     * @param string $name
15
     */
16 55
    public function __construct($name)
17
    {
18 55
        $this->name = $name;
19 55
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 13
    public function close()
25
    {
26 13
        $this->closed = true;
27 13
    }
28
29
    /**
30
     * By Default this is not implemented. For Memory queues it does not make sense.
31
     *
32
     * {@inheritdoc}
33
     */
34 6
    public function acknowledge(Envelope $envelope)
35
    {
36 6
        $this->errorIfClosed();
37 5
    }
38
39
    /**
40
     * @throws InvalidOperationException
41
     */
42 44
    protected function errorIfClosed()
43
    {
44 44
        if ($this->closed) {
45 13
            throw new InvalidOperationException(sprintf('Queue "%s" is closed.', $this->name));
46
        }
47 38
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 13
    public function __toString()
53
    {
54 13
        return (string) $this->name;
55
    }
56
}
57