ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BasicTaskFactory.php
Go to the documentation of this file.
1<?php
2
20
22use ILIAS\BackgroundTasks\Implementation\Values\ScalarValues\BasicScalarValueFactory;
26
28{
29 use BasicScalarValueFactory;
30
31 public function __construct(protected Injector $injector)
32 {
33 }
34
38 public function createTask(string $class_name, ?array $input = null): Task
39 {
40 if (!class_exists($class_name)) {
41 return new NotFoundUserInteraction();
42 }
44 $task = $this->injector->createInstance($class_name);
45 if ($input) {
46 $wrappedInput = array_map(function ($i): Value {
47 if ($i instanceof Task) {
48 return $i->getOutput();
49 }
50 if ($i instanceof Value) {
51 return $i;
52 }
53
54 return $this->wrapValue($i);
55 }, $input);
56
57 $task->setInput($wrappedInput);
58 }
59
60 return $task;
61 }
62}
createTask(string $class_name, ?array $input=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: AbstractJob.php:19
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Job.php:19