DiscardingMessageHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 5
Bugs 3 Features 0
Metric Value
wmc 4
c 5
b 3
f 0
lcom 1
cbo 2
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDiscardChannel() 0 4 1
A getDiscardChannel() 0 4 1
A discardMessage() 0 6 2
1
<?php
2
3
namespace PEIP\ABS\Handler;
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
 * PEIP\ABS\Handler\DiscardingMessageHandler.
15
 *
16
 * @author Timo Michna <timomichna/yahoo.de>
17
 * @extends \PEIP\ABS\Handler\ReplyProducingMessageHandler
18
 * @implements \PEIP\INF\Message\MessageBuilder, \PEIP\INF\Handler\Handler
19
 */
20
abstract class DiscardingMessageHandler extends \PEIP\ABS\Handler\ReplyProducingMessageHandler
21
{
22
    protected $discardChannel;
23
24
    /**
25
     * @param $discardChannel
26
     *
27
     * @return
28
     */
29
    public function setDiscardChannel(\PEIP\INF\Channel\Channel $discardChannel)
30
    {
31
        $this->discardChannel = $discardChannel;
32
    }
33
34
    /**
35
     * @return
36
     */
37
    public function getDiscardChannel()
38
    {
39
        return $this->discardChannel;
40
    }
41
42
    /**
43
     * @param $message
44
     *
45
     * @return
46
     */
47
    protected function discardMessage(\PEIP\INF\Message\Message $message)
48
    {
49
        if (isset($this->discardChannel)) {
50
            $this->discardChannel->send($message);
51
        }
52
    }
53
}
54