context ? stream_context_get_options($this->context) : array(); $http = $context['http'] ?? array(); parse_str((string)($http['content'] ?? ''), $post); self::$requests[] = array('url' => $path, 'http' => $http, 'post' => $post); $reply = self::$reply instanceof \Closure ? (self::$reply)($post) : self::$reply; if ($reply === FALSE) return FALSE; $this->data = (string)$reply; return TRUE; } public function stream_read($count) { $chunk = substr($this->data, $this->position, $count); $this->position += strlen($chunk); return $chunk; } public function stream_eof() { return $this->position >= strlen($this->data); } public function stream_stat() { return array('size' => strlen($this->data)); } public function stream_set_option($option, $arg1, $arg2) { return FALSE; } }