Code Duplication    Length = 5-5 lines in 2 locations

src/Extras/PhpSerial.php 2 locations

@@ 265-269 (lines=5) @@
262
            }
263
            sleep(1);
264
        }
265
        if ($this->handle === false) {
266
            $this->handle = null;
267
            $this->state = self::SERIAL_DEVICE_NOTSET;
268
            throw new RuntimeException('Fail to open device. Check permissions.');
269
        }
270
        stream_set_blocking($this->handle, false);
271
        $this->state = self::SERIAL_DEVICE_OPENED;
272
        return true;
@@ 285-289 (lines=5) @@
282
        if ($this->state !== self::SERIAL_DEVICE_OPENED || ! is_resource($this->handle)) {
283
            return true;
284
        }
285
        if (fclose($this->handle)) {
286
            $this->handle = null;
287
            $this->state = self::SERIAL_DEVICE_SET;
288
            return true;
289
        }
290
        return false;
291
    }
292