Completed
Push — master ( ea20ea...a25393 )
by Timo
41s
created

ClientSession::subscribe()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Tidal/WampWatch package.
5
 *   (c) 2016 Timo Michna <timomichna/yahoo.de>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 */
10
11
namespace Tidal\WampWatch\Adapter\Thruway;
12
13
use Thruway\ClientSession as ThruwaySession;
14
use Tidal\WampWatch\ClientSessionInterface;
15
16
class ClientSession implements ClientSessionInterface
17
{
18
    /**
19
     * @var ThruwaySession
20
     */
21
    protected $thruwaySession;
22
23
    public function __construct(ThruwaySession $thruwaySession)
24
    {
25
        $this->thruwaySession = $thruwaySession;
26
    }
27
28
    /**
29
     * Subscribe.
30
     *
31
     * @param string   $topicName
32
     * @param callable $callback
33
     * @param          $options   array
34
     *
35
     * @return \React\Promise\Promise
36
     */
37
    public function subscribe($topicName, callable $callback, $options = null)
38
    {
39
        return $this->thruwaySession->subscribe($topicName, $callback, $options);
40
    }
41
42
    /**
43
     * Publish.
44
     *
45
     * @param string      $topicName
46
     * @param array|mixed $arguments
47
     * @param array|mixed $argumentsKw
48
     * @param array|mixed $options
49
     *
50
     * @return \React\Promise\Promise
51
     */
52
    public function publish($topicName, $arguments = null, $argumentsKw = null, $options = null)
53
    {
54
        return $this->thruwaySession->publish($topicName, $arguments, $argumentsKw, $options);
55
    }
56
57
    /**
58
     * Register.
59
     *
60
     * @param string      $procedureName
61
     * @param callable    $callback
62
     * @param array|mixed $options
63
     *
64
     * @return \React\Promise\Promise
65
     */
66
    public function register($procedureName, callable $callback, $options = null)
67
    {
68
        return $this->thruwaySession->register($procedureName, $callback, $options);
69
    }
70
71
    /**
72
     * Unregister.
73
     *
74
     * @param string $procedureName
75
     *
76
     * @return \React\Promise\Promise
77
     */
78
    public function unregister($procedureName)
79
    {
80
        return $this->thruwaySession->unregister($procedureName);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->thruwaySession->u...gister($procedureName); of type false|React\Promise\PromiseInterface adds false to the return on line 80 which is incompatible with the return type documented by Tidal\WampWatch\Adapter\...ientSession::unregister of type React\Promise\Promise. It seems like you forgot to handle an error condition.
Loading history...
81
    }
82
83
    /**
84
     * Call.
85
     *
86
     * @param string      $procedureName
87
     * @param array|mixed $arguments
88
     * @param array|mixed $argumentsKw
89
     * @param array|mixed $options
90
     *
91
     * @return \React\Promise\Promise
92
     */
93
    public function call($procedureName, $arguments = null, $argumentsKw = null, $options = null)
94
    {
95
        return $this->thruwaySession->call($procedureName, $arguments, $argumentsKw, $options);
96
    }
97
98
    /**
99
     * @param int $sessionId
100
     */
101
    public function setSessionId($sessionId)
102
    {
103
        $this->thruwaySession->setSessionId($sessionId);
104
    }
105
106
    /**
107
     * @return int the Session Id
108
     */
109
    public function getSessionId()
110
    {
111
        return $this->thruwaySession->getSessionId();
112
    }
113
114
    public function sendMessage($msg)
115
    {
116
        $this->thruwaySession->sendMessage($msg);
117
    }
118
}
119