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
Pull Request — master (#296)
by Andrew
02:32
created

AbstractQueue::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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