Code Duplication    Length = 19-19 lines in 2 locations

PHPDaemon/Core/ShellCommand.php 1 location

@@ 450-468 (lines=19) @@
447
     * @param  string $data Data to send
448
     * @return boolean Success
449
     */
450
    public function write($data)
451
    {
452
        if (!$this->alive) {
453
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
454
            return false;
455
        }
456
        if (!isset($this->bevWrite)) {
457
            return false;
458
        }
459
        if (!mb_orig_strlen($data)) {
460
            return true;
461
        }
462
        $this->writing   = true;
463
        Daemon::$noError = true;
464
        if (!$this->bevWrite->write($data) || !Daemon::$noError) {
465
            $this->close();
466
            return false;
467
        }
468
        return true;
469
    }
470
471
    /**

PHPDaemon/Network/IOStream.php 1 location

@@ 642-660 (lines=19) @@
639
     * @param  string  $data Data to send
640
     * @return boolean       Success
641
     */
642
    public function write($data)
643
    {
644
        if (!$this->alive) {
645
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
646
            return false;
647
        }
648
        if (!isset($this->bev)) {
649
            return false;
650
        }
651
        if (!mb_orig_strlen($data)) {
652
            return true;
653
        }
654
        $this->writing   = true;
655
        Daemon::$noError = true;
656
        if (!$this->bev->write($data) || !Daemon::$noError) {
657
            $this->close();
658
            return false;
659
        }
660
        return true;
661
    }
662
663
    /**