1 | <?php |
||
38 | class ContextSession extends HashMap implements SessionInterface |
||
39 | { |
||
40 | |||
41 | /** |
||
42 | * The connection instances. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $connections = null; |
||
47 | |||
48 | /** |
||
49 | * The session ID used for the connection. |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $sessionId = null; |
||
54 | |||
55 | /** |
||
56 | * The servlet request to load the session ID used for the connection. |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | protected $servletRequest = null; |
||
61 | |||
62 | /** |
||
63 | * Initializes the session with the connection. |
||
64 | * |
||
65 | * @param \AppserverIo\RemoteMethodInvocation\ConnectionInterface $connection The connection for the session |
||
66 | */ |
||
67 | public function __construct(ConnectionInterface $connection) |
||
79 | |||
80 | /** |
||
81 | * Injects the servlet request to load the session ID, for the remote method call, from. |
||
82 | * |
||
83 | * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The servlet request instance to inject |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function injectServletRequest(HttpServletRequestInterface $servletRequest) |
||
88 | { |
||
89 | $this->servletRequest = $servletRequest; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Returns the servlet request instance to load the session ID from. |
||
94 | * |
||
95 | * @return \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The servlet request instance |
||
96 | */ |
||
97 | public function getServletRequest() |
||
98 | { |
||
99 | return $this->servletRequest; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Add's the passed connection to the session's connection collection. |
||
104 | * |
||
105 | * @param \AppserverIo\RemoteMethodInvocation\ConnectionInterface $connection The connection instance to add |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | public function addConnection(ConnectionInterface $connection) |
||
110 | { |
||
111 | $this->connections[] = $connection; |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Returns the collection with the session's connections. |
||
116 | * |
||
117 | * @return array The collection with the session's connections |
||
118 | */ |
||
119 | public function getConnections() |
||
120 | { |
||
121 | return $this->connections; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Returns the connection instance. |
||
126 | * |
||
127 | * @param integer $key The key of the connection to return |
||
128 | * |
||
129 | * @return \AppserverIo\RemoteMethodInvocation\ConnectionInterface The connection instance |
||
130 | */ |
||
131 | public function getConnection($key = 0) |
||
135 | |||
136 | /** |
||
137 | * Returns the ID of the session to use for connecting to the SFSBs. |
||
138 | * |
||
139 | * @return string The session ID |
||
140 | * @see \AppserverIo\RemoteMethodInvocation\SessionInterface::getSessionId() |
||
141 | */ |
||
142 | public function getSessionId() |
||
159 | |||
160 | /** |
||
161 | * The session ID to use. |
||
162 | * |
||
163 | * @param string $sessionId The session ID to use |
||
164 | * |
||
165 | * @return void |
||
166 | */ |
||
167 | public function setSessionId($sessionId) |
||
171 | |||
172 | /** |
||
173 | * Invokes the remote method over the connection. |
||
174 | * |
||
175 | * @param \AppserverIo\RemoteMethodInvocation\RemoteMethodInterface $remoteMethod The remote method call to invoke |
||
176 | * |
||
177 | * @return mixed the method return value |
||
178 | * @see AppserverIo\RemoteMethodInvocation\SessionInterface::send() |
||
179 | * @todo Refactor to replace check for 'setSession' method, e. g. check for an interface |
||
180 | */ |
||
181 | public function send(RemoteMethodInterface $remoteMethod) |
||
201 | |||
202 | /** |
||
203 | * Creates a remote initial context instance. |
||
204 | * |
||
205 | * @return \AppserverIo\RemoteMethodInvocation\RemoteObjectInterface The proxy for the initial context |
||
206 | * @see \AppserverIo\RemoteMethodInvocation\SessionInterface::createInitialContext() |
||
207 | */ |
||
208 | public function createInitialContext() |
||
214 | } |
||
215 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: