Code Duplication    Length = 16-16 lines in 2 locations

PHPDaemon/Core/ShellCommand.php 1 location

@@ 457-472 (lines=16) @@
454
	 * @param  string Data to send
455
	 * @return boolean Success
456
	 */
457
	public function writeln($data) {
458
		if (!$this->alive) {
459
			Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
460
			return false;
461
		}
462
		if (!isset($this->bevWrite)) {
463
			return false;
464
		}
465
		if (!strlen($data) && !strlen($this->EOL)) {
466
			return true;
467
		}
468
		$this->writing = true;
469
		$this->bevWrite->write($data);
470
		$this->bevWrite->write($this->EOL);
471
		return true;
472
	}
473
474
	/**
475
	 * Sets callback which will be called once when got EOF

PHPDaemon/Network/IOStream.php 1 location

@@ 642-657 (lines=16) @@
639
	 * @param  string  $data Data to send
640
	 * @return boolean       Success
641
	 */
642
	public function writeln($data) {
643
		if (!$this->alive) {
644
			Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
645
			return false;
646
		}
647
		if (!isset($this->bev)) {
648
			return false;
649
		}
650
		if (!strlen($data) && !strlen($this->EOL)) {
651
			return true;
652
		}
653
		$this->writing = true;
654
		$this->bev->write($data);
655
		$this->bev->write($this->EOL);
656
		return true;
657
	}
658
659
	/**
660
	 * Finish the session. You should not worry about buffers, they are going to be flushed properly