* Registers a UploadField.
*
* @param UploadField $field
+ *
+ * @throws \InvalidArgumentException if a field with the given fieldId is already registered
*/
public function registerUploadField(UploadField $field) {
if (isset($this->fields[$field->getFieldId()])) {
*
* @param string $fieldId
* @return UploadFile[]
+ *
+ * @throws \InvalidArgumentException if the given fieldId is unknown
*/
public function getFilesForFieldId($fieldId) {
if (!isset($this->fields[$fieldId])) {
* @param string $fieldId
* @param boolean $processFiles
* @return UploadFile[]
+ *
+ * @throws \InvalidArgumentException if the given fieldId is unknown
*/
public function getRemovedFiledForFieldId($fieldId, $processFiles = true) {
if (!isset($this->fields[$fieldId])) {
}
/**
- * @param $internalId
- * @param $uniqueFileId
+ * Removes a file from the upload.
+ *
+ * @param string $internalId
+ * @param string $uniqueFileId
+ *
+ * @throws \InvalidArgumentException if the given internalId is unknown
*/
public function removeFile($internalId, $uniqueFileId) {
if (!$this->isValidInternalId($internalId)) {
/**
* Renders the field with the given fieldId for the template.
+ *
* @param string $fieldId
* @return string
+ *
+ * @throws \InvalidArgumentException if the given fieldId is unknown
*/
public function renderField($fieldId) {
if (!isset($this->fields[$fieldId])) {
}
/**
+ * Checks whether the passed internal file id is valid for an internal id.
*
* @param string $internalId
* @param string $uniqueFileId
* @param string $internalId
* @param string $uniqueFileId
* @return UploadFile|null
+ *
+ * @throws \InvalidArgumentException if the given internalId is unknown
*/
public function getFileForUniqueFileId($internalId, $uniqueFileId) {
if (!$this->isValidInternalId($internalId)) {
*
* @param string $internalId
* @param UploadFile[] $files
+ *
+ * @throws \InvalidArgumentException if the given internalId is unknown
*/
public function registerFilesForInternalId($internalId, array $files) {
if (!$this->isValidInternalId($internalId)) {
*
* @param string $fieldId
* @param UploadFile[] $files
+ *
+ * @throws \InvalidArgumentException if the given fieldId is unknown
*/
public function registerFilesForField($fieldId, array $files) {
if (!isset($this->fields[$fieldId])) {
*
* @param string $internalId
* @return UploadField
+ *
+ * @throws \InvalidArgumentException if the given internalId is unknown
*/
public function getFieldForInternalId($internalId) {
if (!$this->isValidInternalId($internalId)) {
}
/**
- * @param UploadField $field
+ * Remove the removedFiles from the upload process.
+ *
+ * @param UploadField $field
*/
private function processRemovedFiles(UploadField $field) {
$storage = $this->getStorage();
WCF::getSession()->register(self::UPLOAD_HANDLER_SESSION_VAR, $storage);
}
-
- /**
- * Returns the known internalIds.
- *
- * @return string[]
- */
- private function getKnownInternalIds() {
- return array_keys($this->getStorage());
- }
}