DiscardingMessageHandler::getDiscardChannel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 0
Metric Value
c 4
b 2
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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