Code Duplication    Length = 5-5 lines in 3 locations

PHPDaemon/Servers/WebSocket/Connection.php 3 locations

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