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.

Consume::noLocal()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Model\Basic;
5
6
use Innmind\AMQP\Exception\AutoGeneratedConsumerTagRequireServerResponse;
7
use Innmind\Immutable\{
8
    MapInterface,
9
    Map,
10
};
11
12
final class Consume
13
{
14
    private $queue;
15
    private $consumerTag;
16
    private $local = true;
17
    private $ack = true;
18
    private $exclusive = false;
19
    private $wait = true;
20
    private $arguments;
21
22 46
    public function __construct(string $queue)
23
    {
24 46
        $this->queue = $queue;
25 46
        $this->arguments = new Map('string', 'mixed');
26 46
    }
27
28 10
    public function withConsumerTag(string $tag): self
29
    {
30 10
        $self = clone $this;
31 10
        $self->consumerTag = $tag;
32
33 10
        return $self;
34
    }
35
36
    /**
37
     * Let the server define the consumer tag
38
     */
39 2
    public function withAutoGeneratedConsumerTag(): self
40
    {
41 2
        $self = clone $this;
42 2
        $self->consumerTag = null;
43
44 2
        return $self;
45
    }
46
47
    /**
48
     * Means the server will not deliver messages to the consumer
49
     */
50 4
    public function noLocal(): self
51
    {
52 4
        $self = clone $this;
53 4
        $self->local = false;
54
55 4
        return $self;
56
    }
57
58 2
    public function local(): self
59
    {
60 2
        $self = clone $this;
61 2
        $self->local = true;
62
63 2
        return $self;
64
    }
65
66 2
    public function manualAcknowledge(): self
67
    {
68 2
        $self = clone $this;
69 2
        $self->ack = true;
70
71 2
        return $self;
72
    }
73
74 4
    public function autoAcknowledge(): self
75
    {
76 4
        $self = clone $this;
77 4
        $self->ack = false;
78
79 4
        return $self;
80
    }
81
82 4
    public function exclusive(): self
83
    {
84 4
        $self = clone $this;
85 4
        $self->exclusive = true;
86
87 4
        return $self;
88
    }
89
90 2
    public function notExclusive(): self
91
    {
92 2
        $self = clone $this;
93 2
        $self->exclusive = false;
94
95 2
        return $self;
96
    }
97
98 6
    public function dontWait(): self
99
    {
100 6
        if ($this->shouldAutoGenerateConsumerTag()) {
101 2
            throw new AutoGeneratedConsumerTagRequireServerResponse;
102
        }
103
104 4
        $self = clone $this;
105 4
        $self->wait = false;
106
107 4
        return $self;
108
    }
109
110 2
    public function wait(): self
111
    {
112 2
        $self = clone $this;
113 2
        $self->wait = true;
114
115 2
        return $self;
116
    }
117
118 2
    public function withArgument(string $key, $value): self
119
    {
120 2
        $self = clone $this;
121 2
        $self->arguments = $self->arguments->put($key, $value);
122
123 2
        return $self;
124
    }
125
126 30
    public function queue(): string
127
    {
128 30
        return $this->queue;
129
    }
130
131 28
    public function shouldAutoGenerateConsumerTag(): bool
132
    {
133 28
        return !\is_string($this->consumerTag);
134
    }
135
136 6
    public function consumerTag(): string
137
    {
138 6
        return $this->consumerTag;
139
    }
140
141 24
    public function isLocal(): bool
142
    {
143 24
        return $this->local;
144
    }
145
146 24
    public function shouldAutoAcknowledge(): bool
147
    {
148 24
        return !$this->ack;
149
    }
150
151 24
    public function isExclusive(): bool
152
    {
153 24
        return $this->exclusive;
154
    }
155
156 24
    public function shouldWait(): bool
157
    {
158 24
        return $this->wait;
159
    }
160
161
    /**
162
     * @return MapInterface<string, mixed>
163
     */
164 22
    public function arguments(): MapInterface
165
    {
166 22
        return $this->arguments;
167
    }
168
}
169