Skip to content

Commit

Permalink
API Update validation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 2, 2024
1 parent df82059 commit fb83b19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1174,13 +1174,10 @@ public function getAbsoluteSize()
return $this->File->getAbsoluteSize();
}

/**
* @return ValidationResult
*/
public function validate()
public function validate(): ValidationResult
{
$result = ValidationResult::create();
$this->File->validate($result, $this->Name);
$this->File->validateFilename($result, $this->Name);
$this->extend('updateValidate', $result);
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function StripThumbnail()
return null;
}

public function validate()
public function validate(): ValidationResult
{
$result = ValidationResult::create();
$this->extend('updateValidate', $result);
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/DBFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ protected function isValidFilename(string $filename): bool
protected function assertFilenameValid(string $filename): void
{
$result = new ValidationResult();
$this->validate($result, $filename);
$this->validateFilename($result, $filename);
if (!$result->isValid()) {
throw new ValidationException($result);
}
Expand All @@ -466,7 +466,7 @@ protected function assertFilenameValid(string $filename): void
*
* @param null|string $filename Optional filename to validate. If omitted, the current value is validated.
*/
public function validate(ValidationResult $result, ?string $filename = null): bool
public function validateFilename(ValidationResult $result, ?string $filename = null): bool
{
if (empty($filename)) {
$filename = $this->getFilename();
Expand Down

0 comments on commit fb83b19

Please sign in to comment.