Added getParamString method to FormContent.

This commit is contained in:
flash 2023-08-21 20:26:56 +00:00
parent a4c1d5627e
commit 208446b544
2 changed files with 7 additions and 3 deletions

View file

@ -1 +1 @@
0.2308.162302
0.2308.212025

View file

@ -1,7 +1,7 @@
<?php
// FormContent.php
// Created: 2022-02-10
// Updated: 2022-02-27
// Updated: 2023-08-21
namespace Index\Http\Content;
@ -31,6 +31,10 @@ class FormContent implements IHttpContent {
return $this->postFields;
}
public function getParamString(bool $spacesAsPlus = false): string {
return http_build_query($this->postFields, '', '&', $spacesAsPlus ? PHP_QUERY_RFC1738 : PHP_QUERY_RFC3986);
}
public function getUploadedFile(string $name): HttpUploadedFile {
if(!isset($this->uploadedFiles[$name]))
throw new RuntimeException('No file with name $name present.');
@ -49,6 +53,6 @@ class FormContent implements IHttpContent {
}
public function __toString(): string {
return '';
return $this->getParamString();
}
}