. */ /** * Dummy class for reading from string of characters. * @package phing.system.io */ class StringReader extends Reader { /** * @var string */ private $_string; /** * @var int */ private $mark = 0; /** * @var int */ private $currPos = 0; function __construct($string) { $this->_string = $string; } function skip($n) {} function read($len = null) { if ($len === null) { return $this->_string; } else { if ($this->currPos >= strlen($this->_string)) { return -1; } $out = substr($this->_string, $this->currPos, $len); $this->currPos += $len; return $out; } } function mark() { $this->mark = $this->currPos; } function reset() { $this->currPos = $this->mark; } function close() {} function open() {} function ready() {} function markSupported() { return true; } function getResource() { return '(string) "'.$this->_string . '"'; } }