Code Duplication    Length = 5-5 lines in 3 locations

PHPDaemon/Servers/WebSocket/Connection.php 3 locations

@@ 218-222 (lines=5) @@
215
	public function handshake() {
216
217
		$this->route = $this->pool->getRoute($this->server['DOCUMENT_URI'], $this);
218
		if (!$this->route) {
219
			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot handshake session for client "' . $this->addr . '"');
220
			$this->finish();
221
			return false;
222
		}
223
		if (method_exists($this->route, 'onBeforeHandshake')) {
224
			$this->route->onWakeup();
225
			$ret = $this->route->onBeforeHandshake(function($cb) {
@@ 226-230 (lines=5) @@
223
		if (method_exists($this->route, 'onBeforeHandshake')) {
224
			$this->route->onWakeup();
225
			$ret = $this->route->onBeforeHandshake(function($cb) {
226
				if (!$this->sendHandshakeReply()) {
227
					Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake protocol failure for client "' . $this->addr . '"');
228
					$this->finish();
229
					return false;
230
				}
231
			});
232
			$this->route->onSleep();
233
			if ($ret !== false) {
@@ 237-241 (lines=5) @@
234
				return;
235
			}
236
		}
237
		if (!$this->sendHandshakeReply()) {
238
			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake protocol failure for client "' . $this->addr . '"');
239
			$this->finish();
240
			return false;
241
		}
242
		$this->handshaked = true;
243
		$this->headers_sent = true;
244
		$this->state = static::STATE_HANDSHAKED;