DirectChannel::getMessageDispatcher()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
c 2
b 2
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
3
namespace PEIP\Channel;
4
5
namespace PEIP\Channel;
6
7
/*
8
 * This file is part of the PEIP package.
9
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
/*
16
 * DirectChannel
17
 *
18
 * @author Timo Michna <timomichna/yahoo.de>
19
 * @package PEIP
20
 * @subpackage channel
21
 * @extends \PEIP\ABS\Channel\SubscribableChannel
22
 * @implements \PEIP\INF\Channel\SubscribableChannel, \PEIP\INF\Channel\Channel, \PEIP\INF\Event\Connectable
23
 */
24
25
26
27
use PEIP\Dispatcher\IteratingDispatcher;
28
29
class DirectChannel extends \PEIP\ABS\Channel\SubscribableChannel
30
{
31
    /**
32
     * @param $message
33
     * @param $timeout
34
     *
35
     * @return bool wether message was sent successfully
36
     */
37
    public function send(\PEIP\INF\Message\Message $message, $timeout = -1)
38
    {
39
        return $this->doSend($message);
40
    }
41
42
    /**
43
     * @param $message
44
     *
45
     * @return
46
     */
47
    protected function doSend(\PEIP\INF\Message\Message $message)
48
    {
49
        $this->getMessageDispatcher()->notify($message);
50
51
        return true;
52
    }
53
54
    /**
55
     * @return
56
     */
57
    public function getMessageDispatcher()
58
    {
59
        return isset($this->dispatcher) ? $this->dispatcher : $this->dispatcher = new IteratingDispatcher();
0 ignored issues
show
Bug introduced by
The property dispatcher does not seem to exist. Did you mean messageDispatcher?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
60
    }
61
}
62