Completed
Pull Request — master (#6)
by Timo
06:41
created

ClientSession::getSessionId()   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 0
1
<?php
2
3
namespace Tidal\WampWatch\Adapter\Thruway;
4
5
/*
6
 * This file is part of the Tidal/WampWatch package.
7
 * (c) 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
use Thruway\ClientSession as ThruwaySession;
14
use Tidal\WampWatch\ClientSessionInterface;
15
16
17
class ClientSession implements ClientSessionInterface
18
{
19
20
    /**
21
     * @var ThruwaySession
22
     */
23
    protected $thruwaySession;
24
25
    public function __construct(ThruwaySession $thruwaySession)
26
    {
27
        $this->thruwaySession = $thruwaySession;
28
    }
29
30
    /**
31
     * Subscribe
32
     *
33
     * @param string   $topicName
34
     * @param callable $callback
35
     * @param          $options array
36
     * @return \React\Promise\Promise
37
     */
38
    public function subscribe($topicName, callable $callback, $options = null)
39
    {
40
        return $this->thruwaySession->subscribe($topicName, $callback, $options);
41
    }
42
43
    /**
44
     * Publish
45
     *
46
     * @param string      $topicName
47
     * @param array|mixed $arguments
48
     * @param array|mixed $argumentsKw
49
     * @param array|mixed $options
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
     * @return \React\Promise\Promise
64
     */
65
    public function register($procedureName, callable $callback, $options = null)
66
    {
67
        return $this->thruwaySession->register($procedureName, $callback, $options);
68
    }
69
70
    /**
71
     * Unregister
72
     *
73
     * @param string $procedureName
74
     * @return \React\Promise\Promise
75
     */
76
    public function unregister($procedureName)
77
    {
78
        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 78 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...
79
    }
80
81
    /**
82
     * Call
83
     *
84
     * @param string      $procedureName
85
     * @param array|mixed $arguments
86
     * @param array|mixed $argumentsKw
87
     * @param array|mixed $options
88
     * @return \React\Promise\Promise
89
     */
90
    public function call($procedureName, $arguments = null, $argumentsKw = null, $options = null)
91
    {
92
        return $this->thruwaySession->call($procedureName, $arguments, $argumentsKw, $options);
93
    }
94
95
    /**
96
     * @param int $sessionId
97
     */
98
    public function setSessionId($sessionId)
99
    {
100
        $this->thruwaySession->setSessionId($sessionId);
101
    }
102
103
    /**
104
     * @return int the Session Id
105
     */
106
    public function getSessionId()
107
    {
108
        return $this->thruwaySession->getSessionId();
109
    }
110
111
112
}