Wiretap   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 25.93 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 4
Bugs 4 Features 0
Metric Value
wmc 3
c 4
b 4
f 0
lcom 0
cbo 2
dl 7
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 8 2
A doReply() 0 4 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
namespace PEIP\Listener;
4
5
/*
6
 * This file is part of the PEIP package.
7
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
/*
14
 * Wiretap
15
 *
16
 * @author Timo Michna <timomichna/yahoo.de>
17
 * @package PEIP
18
 * @subpackage listener
19
 * @extends \PEIP\Pipe\FixedEventPipe
20
 * @implements \PEIP\INF\Message\MessageBuilder, \PEIP\INF\Handler\Handler, \PEIP\INF\Channel\Channel, \PEIP\INF\Channel\SubscribableChannel, \PEIP\INF\Event\Connectable, \PEIP\INF\Event\Listener
21
 */
22
23
24
25
class Wiretap extends \PEIP\Pipe\FixedEventPipe
26
{
27
    /**
28
     * @param $inputChannel
29
     * @param $outputChannel
30
     *
31
     * @return
32
     */
33 View Code Duplication
    public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = null)
0 ignored issues
show
Duplication introduced by
This method 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...
34
    {
35
        $this->setEventName('preSend');
36
        $this->setInputChannel($inputChannel);
37
        if (is_object($outputChannel)) {
38
            $this->setOutputChannel($outputChannel);
39
        }
40
    }
41
42
    /**
43
     * @param $message
44
     *
45
     * @return
46
     */
47
    protected function doReply(\PEIP\INF\Message\Message $message)
48
    {
49
        $this->replyMessage($message->getHeader('MESSAGE'));
50
    }
51
}
52