Code Duplication    Length = 19-19 lines in 2 locations

PHPDaemon/Network/IOStream.php 1 location

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

PHPDaemon/Core/ShellCommand.php 1 location

@@ 484-502 (lines=19) @@
481
     *
482
     * @return boolean Success
483
     */
484
    public function write ($data)
485
    {
486
        if (!$this->alive) {
487
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
488
489
            return false;
490
        }
491
        if (!isset($this->bevWrite)) {
492
            return false;
493
        }
494
        if (!mb_orig_strlen($data)) {
495
            return true;
496
        }
497
        $this->writing   = true;
498
        Daemon::$noError = true;
499
        if (!$this->bevWrite->write($data) || !Daemon::$noError) {
500
            $this->close();
501
502
            return false;
503
        }
504
505
        return true;