* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class StringStream implements StreamInterface { protected $data; protected $length; protected $pointer = 0; public function __construct($data = '') { $this->data = $data; $this->length = mb_strlen($data); } public function close() { $this->data = null; $this->length = 0; } public function detach() { if ($this->data !== null) { $handle = fopen('php://memory', 'r+'); fwrite($handle, $this->data); fseek($handle, 0); $this->close(); return $handle; } return null; } public function getSize() { return $this->length; } public function tell() { return $this->pointer; } public function eof() { if ($this->data !== null) { return $this->pointer >= $this->length; } return true; } public function rewind() { if ($this->data !== null) { $this->pointer = 0; } return true; } public function isSeekable() { return $this->data !== null; } public function seek($offset, $whence = SEEK_SET) { if ($this->isSeekable()) { if ($whence === SEEK_SET) { $this->pointer = $offset; } elseif ($whence === SEEK_CUR) { $this->pointer+= $offset; } elseif ($whence === SEEK_END) { $this->pointer = $this->length + $offset; } } return false; } public function isWritable() { return $this->data !== null; } public function write($string) { if ($this->isWritable()) { $length = mb_strlen($string); $pre = mb_substr($this->data, 0, $this->pointer); $post = mb_substr($this->data, $this->pointer + $length); $this->data = $pre . $string . $post; $this->pointer+= $length; $this->length = mb_strlen($this->data); return $length; } return false; } public function isReadable() { return $this->data !== null; } public function read($maxLength) { if ($this->isReadable()) { $data = mb_substr($this->data, $this->pointer, $maxLength); $this->pointer+= $maxLength; return $data; } return false; } public function getContents() { if ($this->data === null) { return null; } $data = mb_substr($this->data, $this->pointer); $this->pointer = $this->length; return $data; } public function getMetadata($key = null) { return $key === null ? array() : null; } public function __toString() { $this->pointer = $this->length; return $this->data === null ? '' : $this->data; } } __halt_compiler();----SIGNATURE:----i3tS51Dr/8odZM2pbFdJfp+EZNVFpHz21bQP6gICXNaBk8yNmrkaznrT5M4pFnek63rMWlwW0emujWPNEzUH2geqogSoeoUqx8uetFcBxDSH55jRFZalKL0B3D3qX0JlmZ+qCKQGQukQbTNqqHDSosK0vuuL3xVRMnwc4k33Mi57RWHUjd7xfFKkD5CQOZ7qsMDvj4cwBUbCRQZ3LLIFEPUIsyHseZtsN3CXkq7QG9lpeJoImbnSMxo4r7qcKPtuJ3k3IypIFY3jbZVg7zulRMbXcii5qUIW+0/PdGp8pjCmOdN9ruhrSlwl6am8T/ol4AeMlysjLoczh0NmHbRF/ml66XGsRUlFVBBa8kCRXXc5B0f8fw60XOtLVaoyeXNJaKjwfmIfN8iMYxV+mqoTiPxezlF7DtbBZ+x0UjcBlGJNa5YrDX/3bJx1DTrEp65qFAhn8Mb7mUSOWuCGqx18D2rNrClx2erYRxqheJw1vNKn7E95nerpUdxP69MLvaAcjE26Froc+37rvxYbErbDKV45sirdFXTvaBvUWA18mG+a6sh82ICE6BDcrwrw28f6qjklCL31tc/TJrlC6Iksai8jsi3R9mV8djbHm4vBGJNlxafqxTLdjE6u1qOKTylM4gia7ZkPkfSAVbBJbzfAENr3IPb7z4dYsd7yoXXBKdk=----ATTACHMENT:----Mjk3OTk4MzA2NDgxNDM2OSAzNDg1OTM5NjMwMzg0MjA4IDY1OTE2NjA4MjExNzU5MTc=