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   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 68.18%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 49
ccs 15
cts 22
cp 0.6818
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A close() 0 4 1
A acknowledge() 0 4 1
A errorIfClosed() 0 6 2
A __toString() 0 4 1
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