*/
public function schedule(string $input, string $type, string $appId, string $identifier = ''): DataResponse {
try {
- $task = Task::factory($type, $input, $this->userId, $appId, $identifier);
+ $task = new Task($type, $input, $this->userId, $appId, $identifier);
} catch (InvalidArgumentException) {
return new DataResponse(['message' => $this->l->t('Requested task type does not exist')], Http::STATUS_BAD_REQUEST);
}
}
public function toPublicTask(): OCPTask {
- $task = OCPTask::factory($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier());
+ $task = new OCPTask($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier());
$task->setId($this->getId());
$task->setStatus($this->getStatus());
$task->setOutput($this->getOutput());
'identifier' => $this->getIdentifier(),
];
}
-
- /**
- * @param string $type
- * @param string $input
- * @param string|null $userId
- * @param string $appId
- * @param string $identifier
- * @return Task
- * @throws \InvalidArgumentException
- * @since 27.1.0
- */
- final public static function factory(string $type, string $input, ?string $userId, string $appId, string $identifier = ''): Task {
- if (!in_array($type, self::TYPES)) {
- throw new \InvalidArgumentException('Unknown task type');
- }
- return new Task($type, $input, $appId, $userId, $identifier);
- }
}