Code Duplication    Length = 7-8 lines in 2 locations

src/Comodojo/Daemon/Socket/Server.php 1 location

@@ 321-328 (lines=8) @@
318
        $datagram = '';
319
        $socket = $connection->getSocket();
320
321
        while (true) {
322
            $recv = @socket_read($socket, $this->read_buffer, PHP_NORMAL_READ);
323
            // if ( $recv === false ) break;
324
            // if ( $recv === 0 ) return null;
325
            if ( $recv === false ) return null;
326
            $datagram .= $recv;
327
            if (empty($recv) || strstr($recv, PHP_EOL)) break;
328
        }
329
330
        $datagram = trim($datagram);
331

src/Comodojo/Daemon/Socket/SocketTransport.php 1 location

@@ 190-196 (lines=7) @@
187
188
        $datagram = '';
189
190
        while (true) {
191
            $recv = @socket_read($this->socket, $this->read_buffer, PHP_NORMAL_READ);
192
            if ( $recv === false ) break;
193
            if ( $recv === 0 ) return null;
194
            $datagram .= $recv;
195
            if(strstr($recv, PHP_EOL)) break;
196
        }
197
198
        return trim($datagram);
199