Skip to content

Commit

Permalink
API allow chaining for Upload_Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr authored Jul 20, 2021
1 parent 42ee290 commit d04aefb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Upload_Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,28 @@ public function getErrors()

/**
* Clear out all errors
*
* @return $this
*/
public function clearErrors()
{
$this->errors = [];

return $this;
}

/**
* Set information about temporary file produced by PHP.
*
* @param array $tmpFile
*
* @return $this
*/
public function setTmpFile($tmpFile)
{
$this->tmpFile = $tmpFile;

return $this;
}


Expand Down Expand Up @@ -153,6 +162,8 @@ public function getAllowedMaxFileSize($ext = null)
* </code>
*
* @param array|int|string $rules
*
* @return $this
*/
public function setAllowedMaxFileSize($rules)
{
Expand All @@ -177,6 +188,8 @@ public function setAllowedMaxFileSize($rules)
} elseif ((int)$rules > 0) {
$this->allowedMaxFileSize['*'] = (int)$rules;
}

return $this;
}

/**
Expand All @@ -195,6 +208,8 @@ public function getAllowedExtensions()
* See {@link setAllowedMaxFileSize()} to limit file size by extension.
*
* @param array $rules List of extensions
*
* @return $this
*/
public function setAllowedExtensions($rules)
{
Expand All @@ -208,6 +223,8 @@ public function setAllowedExtensions($rules)
}

$this->allowedExtensions = $rules;

return $this;
}

/**
Expand Down

0 comments on commit d04aefb

Please sign in to comment.