public function stream_read($count) { self::$_arguments[__FUNCTION__] = func_get_args(); if (array_key_exists(__FUNCTION__, self::$_returnValues)) { return self::$_returnValues[__FUNCTION__]; } // To match the behavior of php://input, we need to clear out the data // as it is read if ($count > strlen(self::$_data)) { $data = self::$_data; self::$_data = ''; } else { $data = substr(self::$_data, 0, $count); self::$_data = substr(self::$_data, $count); } return $data; }