Code Duplication    Length = 19-19 lines in 2 locations

PHPDaemon/Core/ShellCommand.php 1 location

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

PHPDaemon/Network/IOStream.php 1 location

@@ 658-676 (lines=19) @@
655
     * @param  string $data Data to send
656
     * @return boolean       Success
657
     */
658
    public function write($data)
659
    {
660
        if (!$this->alive) {
661
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
662
            return false;
663
        }
664
        if (!isset($this->bev)) {
665
            return false;
666
        }
667
        if (!mb_orig_strlen($data)) {
668
            return true;
669
        }
670
        $this->writing = true;
671
        Daemon::$noError = true;
672
        if (!$this->bev->write($data) || !Daemon::$noError) {
673
            $this->close();
674
            return false;
675
        }
676
        return true;
677
    }
678
679
    /**