Skip to content

Commit 7389567

Browse files
committed
Remove Task::factory method
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent d63c122 commit 7389567

3 files changed

Lines changed: 2 additions & 19 deletions

File tree

core/Controller/TextProcessingApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function taskTypes(): DataResponse {
9191
*/
9292
public function schedule(string $input, string $type, string $appId, string $identifier = ''): DataResponse {
9393
try {
94-
$task = Task::factory($type, $input, $this->userId, $appId, $identifier);
94+
$task = new Task($type, $input, $this->userId, $appId, $identifier);
9595
} catch (InvalidArgumentException) {
9696
return new DataResponse(['message' => $this->l->t('Requested task type does not exist')], Http::STATUS_BAD_REQUEST);
9797
}

lib/private/TextProcessing/Db/Task.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static function fromPublicTask(OCPTask $task): Task {
103103
}
104104

105105
public function toPublicTask(): OCPTask {
106-
$task = OCPTask::factory($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier());
106+
$task = new OCPTask($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier());
107107
$task->setId($this->getId());
108108
$task->setStatus($this->getStatus());
109109
$task->setOutput($this->getOutput());

lib/public/TextProcessing/Task.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,4 @@ public function jsonSerialize(): array {
218218
'identifier' => $this->getIdentifier(),
219219
];
220220
}
221-
222-
/**
223-
* @param string $type
224-
* @param string $input
225-
* @param string|null $userId
226-
* @param string $appId
227-
* @param string $identifier
228-
* @return Task
229-
* @throws \InvalidArgumentException
230-
* @since 27.1.0
231-
*/
232-
final public static function factory(string $type, string $input, ?string $userId, string $appId, string $identifier = ''): Task {
233-
if (!in_array($type, self::TYPES)) {
234-
throw new \InvalidArgumentException('Unknown task type');
235-
}
236-
return new Task($type, $input, $appId, $userId, $identifier);
237-
}
238221
}

0 commit comments

Comments
 (0)