postFields = $postFields; $this->uploadedFiles = $uploadedFiles; } public function getParam(string $name, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed { if(!isset($this->postFields[$name])) return null; return filter_var($this->postFields[$name] ?? null, $filter, $options); } public function hasParam(string $name): bool { return isset($this->postFields[$name]); } public function getParams(): array { return $this->postFields; } public function getUploadedFile(string $name): HttpUploadedFile { if(!isset($this->uploadedFiles[$name])) throw new RuntimeException('No file with name $name present.'); return $this->uploadedFiles[$name]; } public static function fromRaw(array $post, array $files): FormContent { return new FormContent( $post, HttpUploadedFile::createFromFILES($files) ); } public static function fromRequest(): FormContent { return self::fromRaw($_POST, $_FILES); } public function __toString(): string { return ''; } }