From d04aefbdd1657f10306855e8931751848be9737d Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 20 Jul 2021 12:58:41 +1200 Subject: [PATCH] API allow chaining for Upload_Validator --- src/Upload_Validator.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Upload_Validator.php b/src/Upload_Validator.php index 799e212f..0b6e8311 100644 --- a/src/Upload_Validator.php +++ b/src/Upload_Validator.php @@ -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; } @@ -153,6 +162,8 @@ public function getAllowedMaxFileSize($ext = null) * * * @param array|int|string $rules + * + * @return $this */ public function setAllowedMaxFileSize($rules) { @@ -177,6 +188,8 @@ public function setAllowedMaxFileSize($rules) } elseif ((int)$rules > 0) { $this->allowedMaxFileSize['*'] = (int)$rules; } + + return $this; } /** @@ -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) { @@ -208,6 +223,8 @@ public function setAllowedExtensions($rules) } $this->allowedExtensions = $rules; + + return $this; } /**