Test Failed
Pull Request — master (#9)
by Nicolas
02:36
created

InMemory::isLastRetry()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Puzzle\AMQP\Messages;
4
5
use Puzzle\AMQP\ReadableMessage;
6
use Puzzle\AMQP\WritableMessage;
7
8
class InMemory extends Message implements ReadableMessage, WritableMessage
9
{
10
    public function getRawBody()
11
    {
12
        return $this->getFormattedBody();
13
    }
14
15
    public function getDecodedBody()
16
    {
17
        return (new MessageDecoder())->decode($this);
18
    }
19
20
    public function getAttributes()
21
    {
22
        return $this->packAttributes();
23
    }
24
25
    public function isLastRetry($retryOccurence = \Puzzle\AMQP\Consumers\Retry::DEFAULT_RETRY_OCCURENCE)
26
    {
27
        $retryHeader = $this->getHeader(\Puzzle\AMQP\Consumers\Retry::DEFAULT_RETRY_HEADER);
0 ignored issues
show
Bug introduced by
The method getHeader() does not exist on Puzzle\AMQP\Messages\InMemory. Did you maybe mean getHeaders()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28
29
        return (!empty($retryHeader) && (int) $retryHeader === $retryOccurence);
30
    }
31
32
    public function getRoutingKeyFromHeader()
33
    {
34
        $headers = $this->getHeaders();
35
36
        if(! array_key_exists('routing_key', $headers))
37
        {
38
            return null;
39
        }
40
41
        return $headers['routing_key'];
42
    }
43
}
44