Code Duplication    Length = 9-10 lines in 2 locations

PHPDaemon/Clients/WebSocket/Connection.php 1 location

@@ 235-243 (lines=9) @@
232
				chr($payloadLength & 0xFF);
233
		}
234
		$this->write($hdrPacket);
235
		if ($isMasked) {
236
			$this->write($mask = chr(mt_rand(0, 0xFF)) .
237
				chr(mt_rand(0, 0xFF)) .
238
				chr(mt_rand(0, 0xFF)) .
239
				chr(mt_rand(0, 0xFF)));
240
			$this->write(static::mask($mask, $payload));
241
		} else {
242
			$this->write($payload);
243
		}
244
	}
245
246
	/**

PHPDaemon/Servers/WebSocket/Protocols/V13.php 1 location

@@ 122-131 (lines=10) @@
119
					chr($dataLength >> 8) .
120
					chr($dataLength & 0xFF));
121
		}
122
		if ($isMasked) {
123
			$mask	= chr(mt_rand(0, 0xFF)) .
124
					chr(mt_rand(0, 0xFF)) .
125
					chr(mt_rand(0, 0xFF)) .
126
					chr(mt_rand(0, 0xFF));
127
			$this->write($mask . $this->mask($data, $mask));
128
		}
129
		else {
130
			$this->write($data);
131
		}
132
		if ($cb !== null) {
133
			$this->onWriteOnce($cb);
134
		}