Completed
Pull Request — master (#1)
by Sergey
04:51
created

BasicRecover   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 39
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A isRequeue() 4 4 1
A encode() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/*
3
 * This file is automatically generated.
4
 */
5
6
namespace ButterAMQP\AMQP091\Framing\Method;
7
8
use ButterAMQP\AMQP091\Framing\Frame;
9
use ButterAMQP\Value;
10
11
/**
12
 * Redeliver unacknowledged messages.
13
 *
14
 * @codeCoverageIgnore
15
 */
16 View Code Duplication
class BasicRecover extends Frame
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * @var bool
20
     */
21
    private $requeue;
22
23
    /**
24
     * @param int  $channel
25
     * @param bool $requeue
26
     */
27
    public function __construct($channel, $requeue)
28
    {
29
        $this->requeue = $requeue;
30
31
        parent::__construct($channel);
32
    }
33
34
    /**
35
     * Requeue the message.
36
     *
37
     * @return bool
38
     */
39
    public function isRequeue()
40
    {
41
        return $this->requeue;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function encode()
48
    {
49
        $data = "\x00\x3C\x00\x6E".
50
            Value\BooleanValue::encode($this->requeue);
51
52
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
53
    }
54
}
55