Code Duplication    Length = 9-10 lines in 3 locations

PHPDaemon/Network/IOStream.php 3 locations

@@ 451-459 (lines=9) @@
448
	 * @param  integer $o Offset
449
	 * @return string|false
450
	 */
451
	public function lookExact($n, $o = 0) {
452
		if (!isset($this->bev)) {
453
			return false;
454
		}
455
		if ($o + $n > $this->bev->input->length) {
456
			return false;
457
		}
458
		return $this->bev->input->substr($o, $n);
459
	}
460
461
	/**
462
	 * Prepends data to input buffer
@@ 491-499 (lines=9) @@
488
	 * @param integer $o Offset
489
	 * @return string|false
490
	 */
491
	public function look($n, $o = 0) {
492
		if (!isset($this->bev)) {
493
			return false;
494
		}
495
		if ($this->bev->input->length <= $o) {
496
			return '';
497
		}
498
		return $this->bev->input->substr($o, $n);
499
	}
500
501
	/**
502
	 * Read from buffer without draining
@@ 906-915 (lines=10) @@
903
	 * Reads all data from the connection's buffer
904
	 * @return string Readed data
905
	 */
906
	public function readUnlimited() {
907
		if (!isset($this->bev)) {
908
			return false;
909
		}
910
		$read = $this->bev->read($this->bev->input->length);
911
		if ($read === null) {
912
			return false;
913
		}
914
		return $read;
915
	}
916
}
917