Code Duplication    Length = 4-5 lines in 2 locations

PHPDaemon/Clients/WebSocket/Connection.php 2 locations

@@ 128-132 (lines=5) @@
125
                $this->pctLength = Binary::b2i($this->read(8));
126
            }
127
128
            if ($this->pool->maxAllowedPacket < $this->pctLength) {
129
                Daemon::$process->log('max-allowed-packet (' . $this->pool->config->maxallowedpacket->getHumanValue() . ') exceed, aborting connection');
130
                $this->finish();
131
                return;
132
            }
133
            $this->setWatermark($this->pctLength + ($this->isMasked ? 4 : 0));
134
            $this->state = static::STATE_DATA;
135
        }
@@ 188-191 (lines=4) @@
185
    public function sendFrame($payload, $type = Pool::TYPE_TEXT, $isMasked = true)
186
    {
187
        $payloadLength = mb_orig_strlen($payload);
188
        if ($payloadLength > $this->pool->maxAllowedPacket) {
189
            Daemon::$process->log('max-allowed-packet (' . $this->pool->config->maxallowedpacket->getHumanValue() . ') exceed, aborting connection');
190
            return;
191
        }
192
193
        $firstByte = '';
194
        switch ($type) {