diff options
author | Marcel Klehr <mklehr@gmx.net> | 2024-05-14 10:01:09 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2024-05-14 11:38:42 +0200 |
commit | cac812dc580079f2772623641ba70985714ad7b2 (patch) | |
tree | 55251f2baa2c66aacd44919542b568efa2abefa1 /lib/public | |
parent | f5a8bda1bad42e2ecc0e5601171a5f0967de65fa (diff) | |
download | nextcloud-server-cac812dc580079f2772623641ba70985714ad7b2.tar.gz nextcloud-server-cac812dc580079f2772623641ba70985714ad7b2.zip |
fix: address review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/TaskProcessing/EShapeType.php | 12 | ||||
-rw-r--r-- | lib/public/TaskProcessing/ShapeDescriptor.php | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/public/TaskProcessing/EShapeType.php b/lib/public/TaskProcessing/EShapeType.php index 5555671976b..1f612a11dd5 100644 --- a/lib/public/TaskProcessing/EShapeType.php +++ b/lib/public/TaskProcessing/EShapeType.php @@ -42,8 +42,8 @@ enum EShapeType: int { case ListOfNumbers = 10; case ListOfTexts = 11; case ListOfImages = 12; - case ListOfAudio = 13; - case ListOfVideo = 14; + case ListOfAudios = 13; + case ListOfVideos = 14; case ListOfFiles = 15; /** @@ -84,13 +84,13 @@ enum EShapeType: int { if ($this === EShapeType::Audio && !is_numeric($value)) { throw new ValidationException('Non-audio item provided for Audio slot'); } - if ($this === EShapeType::ListOfAudio && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + if ($this === EShapeType::ListOfAudios && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { throw new ValidationException('Non-audio list item provided for ListOfAudio slot'); } if ($this === EShapeType::Video && !is_numeric($value)) { throw new ValidationException('Non-video item provided for Video slot'); } - if ($this === EShapeType::ListOfVideo && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + if ($this === EShapeType::ListOfVideos && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { throw new ValidationException('Non-video list item provided for ListOfTexts slot'); } if ($this === EShapeType::File && !is_numeric($value)) { @@ -116,13 +116,13 @@ enum EShapeType: int { if ($this === EShapeType::Audio && !is_string($value)) { throw new ValidationException('Non-audio item provided for Audio slot'); } - if ($this === EShapeType::ListOfAudio && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item))) > 0)) { + if ($this === EShapeType::ListOfAudios && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item))) > 0)) { throw new ValidationException('Non-audio list item provided for ListOfAudio slot'); } if ($this === EShapeType::Video && !is_string($value)) { throw new ValidationException('Non-video item provided for Video slot'); } - if ($this === EShapeType::ListOfVideo && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item))) > 0)) { + if ($this === EShapeType::ListOfVideos && (!is_array($value) || count(array_filter($value, fn ($item) => !is_string($item))) > 0)) { throw new ValidationException('Non-video list item provided for ListOfTexts slot'); } if ($this === EShapeType::File && !is_string($value)) { diff --git a/lib/public/TaskProcessing/ShapeDescriptor.php b/lib/public/TaskProcessing/ShapeDescriptor.php index 6c14bab751e..b389b0cebd2 100644 --- a/lib/public/TaskProcessing/ShapeDescriptor.php +++ b/lib/public/TaskProcessing/ShapeDescriptor.php @@ -45,14 +45,16 @@ class ShapeDescriptor implements \JsonSerializable { } /** - * @return array{name: string, description: string, type: int} + * @return array{name: string, description: string, type: "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles"} * @since 30.0.0 */ public function jsonSerialize(): array { + /** @var "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles" $type */ + $type = $this->getShapeType()->name; return [ 'name' => $this->getName(), 'description' => $this->getDescription(), - 'type' => $this->getShapeType()->value, + 'type' => $type, ]; } } |