Code Duplication    Length = 19-19 lines in 2 locations

PHPDaemon/Core/ShellCommand.php 1 location

@@ 411-429 (lines=19) @@
408
     * @param  string $data Data to send
409
     * @return boolean Success
410
     */
411
    public function write($data)
412
    {
413
        if (!$this->alive) {
414
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
415
            return false;
416
        }
417
        if (!isset($this->bevWrite)) {
418
            return false;
419
        }
420
        if (!mb_orig_strlen($data)) {
421
            return true;
422
        }
423
        $this->writing = true;
424
        Daemon::$noError = true;
425
        if (!$this->bevWrite->write($data) || !Daemon::$noError) {
426
            $this->close();
427
            return false;
428
        }
429
        return true;
430
    }
431
432
    /**

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
    /**