1 | <?php |
||
23 | abstract class TunnelServer implements TunnelServerInterface |
||
24 | { |
||
25 | use UseTimerTrait; |
||
26 | |||
27 | /** |
||
28 | * @var ConnectionInterface |
||
29 | */ |
||
30 | protected $controlConnection; |
||
31 | |||
32 | /** |
||
33 | * @var PublicConnectionCollection |
||
34 | */ |
||
35 | protected $publicConnections; |
||
36 | |||
37 | /** |
||
38 | * @var Socket |
||
39 | */ |
||
40 | protected $socket; |
||
41 | |||
42 | /** |
||
43 | * @var TunnelInterface |
||
44 | */ |
||
45 | protected $tunnel; |
||
46 | |||
47 | /** |
||
48 | * @var Server |
||
49 | */ |
||
50 | protected $server; |
||
51 | |||
52 | /** |
||
53 | * @var LoopInterface |
||
54 | */ |
||
55 | protected $loop; |
||
56 | |||
57 | public function __construct(Server $server, ConnectionInterface $controlConnection, TunnelInterface $tunnel, LoopInterface $loop) |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | * @codeCoverageIgnore |
||
69 | */ |
||
70 | public function run() |
||
71 | { |
||
72 | $this->socket = new Socket($this->getListenAddress(), $this->loop); |
||
73 | $this->socket->on('connection', function($connection){ |
||
74 | $publicConnection = new PublicConnection($connection); |
||
75 | $this->publicConnections->add($publicConnection); |
||
76 | $this->handlePublicConnection($publicConnection); |
||
77 | }); |
||
78 | //Creates defaults timers |
||
79 | foreach ($this->getDefaultTimers() as $timer) { |
||
80 | $this->addTimer($timer); |
||
81 | } |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Gets the event dispatcher |
||
86 | * @return Dispatcher |
||
87 | */ |
||
88 | public function getDispatcher() |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function close() |
||
110 | |||
111 | /** |
||
112 | * Handles the public connection |
||
113 | * @param PublicConnection $publicConnection |
||
114 | * @codeCoverageIgnore |
||
115 | */ |
||
116 | public function handlePublicConnection(PublicConnection $publicConnection) |
||
129 | |||
130 | /** |
||
131 | * Registers proxy connection |
||
132 | * @param ConnectionInterface $proxyConnection |
||
133 | * @param SpikeInterface $message |
||
134 | * @codeCoverageIgnore |
||
135 | */ |
||
136 | public function registerProxyConnection(ConnectionInterface $proxyConnection, SpikeInterface $message) |
||
176 | |||
177 | /** |
||
178 | * Gets the server |
||
179 | * @return Server |
||
180 | */ |
||
181 | public function getServer() |
||
185 | |||
186 | /** |
||
187 | * Gets the server address to bind |
||
188 | * @return string |
||
189 | */ |
||
190 | protected function getListenAddress() |
||
194 | |||
195 | /** |
||
196 | * Creates default timers |
||
197 | * @return TimerInterface[] |
||
198 | */ |
||
199 | protected function getDefaultTimers() |
||
205 | |||
206 | /** |
||
207 | * Gets the socket of the tunnel server |
||
208 | * @return Socket |
||
209 | */ |
||
210 | public function getSocket() |
||
214 | |||
215 | /** |
||
216 | * {@inheritdoc} |
||
217 | */ |
||
218 | public function getControlConnection() |
||
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | public function getLoop() |
||
230 | |||
231 | /** |
||
232 | * {@inheritdoc} |
||
233 | */ |
||
234 | public function getPublicConnections() |
||
238 | |||
239 | /** |
||
240 | * {@inheritdoc} |
||
241 | */ |
||
242 | public function getTunnel() |
||
246 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..