ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
BasicTaskFactory.php
Go to the documentation of this file.
1
<?php
2
3
namespace
ILIAS\BackgroundTasks\Implementation\Tasks
;
4
5
use
ILIAS\BackgroundTasks\Dependencies\Injector
;
6
use
ILIAS\BackgroundTasks\Exceptions\InvalidArgumentException
;
7
use
ILIAS\BackgroundTasks\Implementation\Values\ScalarValues\BasicScalarValueFactory
;
8
use
ILIAS\BackgroundTasks\Task
;
9
use
ILIAS\BackgroundTasks\Task\TaskFactory
;
10
use
ILIAS\BackgroundTasks\Value
;
11
12
class
BasicTaskFactory
implements
TaskFactory
13
{
14
use
BasicScalarValueFactory
;
18
protected
$injector
;
19
20
21
public
function
__construct
(
Injector
$injector
)
22
{
23
$this->injector =
$injector
;
24
}
25
26
30
public
function
createTask
($class_name, $input = null)
31
{
32
if
(!class_exists($class_name)) {
33
require_once(
'./src/BackgroundTasks/Implementation/Tasks/NotFoundUserInteraction.php'
);
34
return
new
NotFoundUserInteraction
();
35
}
37
$task = $this->injector->createInstance($class_name);
38
if
(!$task instanceof
Task
) {
39
throw
new
InvalidArgumentException
(
"The given classname $class_name is not a task."
);
40
}
41
if
($input) {
42
$wrappedInput = array_map(
function
(
$i
) {
43
if
(
$i
instanceof Task) {
44
return
$i
->getOutput();
45
}
46
if
(
$i
instanceof
Value
) {
47
return
$i
;
48
}
49
50
return
$this->wrapValue(
$i
);
51
}, $input);
52
53
$task->setInput($wrappedInput);
54
}
55
56
return
$task;
57
}
58
}
ILIAS\BackgroundTasks\Dependencies\Injector
Definition:
Injector.php:19
InvalidArgumentException
BasicScalarValueFactory
ILIAS\BackgroundTasks\Implementation\Tasks
Definition:
AbstractJob.php:3
ILIAS\BackgroundTasks\Task\TaskFactory\createTask
createTask($class_name, $input=null)
ILIAS\BackgroundTasks\Value
Definition:
Value.php:15
ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory
Definition:
BasicTaskFactory.php:12
ILIAS\BackgroundTasks\Task
Definition:
Task.php:21
ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory\__construct
__construct(Injector $injector)
Definition:
BasicTaskFactory.php:21
ILIAS\BackgroundTasks\Implementation\Tasks\NotFoundUserInteraction
Class NotFoundUserInteraction.
Definition:
NotFoundUserInteraction.php:14
Injector
ILIAS\BackgroundTasks\Task
Definition:
Job.php:3
TaskFactory
ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory\$injector
$injector
Definition:
BasicTaskFactory.php:18
BasicScalarValueFactory
InvalidArgumentException
ILIAS\BackgroundTasks\Task\TaskFactory
Definition:
TaskFactory.php:8
Value
$i
$i
Definition:
metadata.php:24
src
BackgroundTasks
Implementation
Tasks
BasicTaskFactory.php
Generated on Wed Apr 2 2025 21:01:41 for ILIAS by
1.8.13 (using
Doxyfile
)