ILIAS  release_8 Revision v8.24
BasicTaskFactory.php
Go to the documentation of this file.
1<?php
2
20
23use ILIAS\BackgroundTasks\Implementation\Values\ScalarValues\BasicScalarValueFactory;
27
29{
30 use BasicScalarValueFactory;
31
32 protected \ILIAS\BackgroundTasks\Dependencies\Injector $injector;
33
35 {
36 $this->injector = $injector;
37 }
38
42 public function createTask(string $class_name, ?array $input = null): Task
43 {
44 if (!class_exists($class_name)) {
45 return new NotFoundUserInteraction();
46 }
48 $task = $this->injector->createInstance($class_name);
49 if ($input) {
50 $wrappedInput = array_map(function ($i): \ILIAS\BackgroundTasks\Value {
51 if ($i instanceof Task) {
52 return $i->getOutput();
53 }
54 if ($i instanceof Value) {
55 return $i;
56 }
57
58 return $this->wrapValue($i);
59 }, $input);
60
61 $task->setInput($wrappedInput);
62 }
63
64 return $task;
65 }
66}
Class Exception Thrown if some procedure did not get the arguments it expected.
ILIAS BackgroundTasks Dependencies Injector $injector
createTask(string $class_name, ?array $input=null)
$i
Definition: metadata.php:41
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
Class ChatMainBarProvider \MainMenu\Provider.