diff options
author | Marcel Klehr <mklehr@gmx.net> | 2024-05-06 16:36:35 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2024-05-14 11:38:41 +0200 |
commit | ec27c538b531108ab2cf26fe3264d001f9230aa2 (patch) | |
tree | 6618f6771a34642eece57f89b0f2a224880108ea /core/Controller | |
parent | ef61c50f4bcd5ea5911370c682aff19618a4d355 (diff) | |
download | nextcloud-server-ec27c538b531108ab2cf26fe3264d001f9230aa2.tar.gz nextcloud-server-ec27c538b531108ab2cf26fe3264d001f9230aa2.zip |
fix: address review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/TaskProcessingApiController.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 2195d780f45..d28d0baeb5d 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -98,7 +98,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { /** * This endpoint allows scheduling a task * - * @param array<string, mixed> $input Input text + * @param array<string, mixed> $input Task's input parameters * @param string $type Type of the task * @param string $appId ID of the app that will execute the task * @param string $identifier An arbitrary identifier for the task @@ -171,7 +171,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @param int $id The id of the task * - * @return DataResponse<Http::STATUS_OK, array{}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Task returned */ @@ -260,10 +260,10 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { /** * @param Task $task - * @return list<mixed> + * @return list<int> * @throws \OCP\TaskProcessing\Exception\NotFoundException */ - private function extractFileIdsFromTask(Task $task) { + private function extractFileIdsFromTask(Task $task): array { $ids = []; $taskTypes = $this->taskProcessingManager->getAvailableTaskTypes(); if (!isset($taskTypes[$task->getTaskTypeId()])) { @@ -272,6 +272,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { $taskType = $taskTypes[$task->getTaskTypeId()]; foreach ($taskType['inputShape'] + $taskType['optionalInputShape'] as $key => $descriptor) { if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) { + /** @var int|list<int> $inputSlot */ $inputSlot = $task->getInput()[$key]; if (is_array($inputSlot)) { $ids += $inputSlot; @@ -283,6 +284,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { if ($task->getOutput() !== null) { foreach ($taskType['outputShape'] + $taskType['optionalOutputShape'] as $key => $descriptor) { if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) { + /** @var int|list<int> $outputSlot */ $outputSlot = $task->getOutput()[$key]; if (is_array($outputSlot)) { $ids += $outputSlot; @@ -292,7 +294,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { } } } - return $ids; + return array_values($ids); } /** |