|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Darkilliant\ProcessBundle\ProcessNotifier; |
|
4
|
|
|
|
|
5
|
|
|
use Darkilliant\ProcessBundle\State\ProcessState; |
|
6
|
|
|
use Darkilliant\ProcessBundle\Step\StepInterface; |
|
7
|
|
|
|
|
8
|
|
|
class ChainProcessNotifier implements ProcessNotifierInterface |
|
9
|
|
|
{ |
|
10
|
|
|
/** @var ProcessNotifierInterface[] */ |
|
11
|
|
|
private $notifiers = []; |
|
12
|
|
|
|
|
13
|
5 |
|
public function add(ProcessNotifierInterface $notifier) |
|
14
|
|
|
{ |
|
15
|
5 |
|
$this->notifiers[] = $notifier; |
|
16
|
5 |
|
} |
|
17
|
|
|
|
|
18
|
1 |
|
public function onExecutedProcess(ProcessState $state, StepInterface $step) |
|
19
|
|
|
{ |
|
20
|
1 |
|
foreach ($this->notifiers as $notifier) { |
|
21
|
1 |
|
$notifier->onExecutedProcess($state, $step); |
|
22
|
|
|
} |
|
23
|
1 |
|
} |
|
24
|
|
|
|
|
25
|
1 |
|
public function onStartProcess(ProcessState $state, StepInterface $step) |
|
26
|
|
|
{ |
|
27
|
1 |
|
foreach ($this->notifiers as $notifier) { |
|
28
|
1 |
|
$notifier->onStartProcess($state, $step); |
|
29
|
|
|
} |
|
30
|
1 |
|
} |
|
31
|
|
|
|
|
32
|
1 |
|
public function onEndProcess(ProcessState $state, StepInterface $step) |
|
33
|
|
|
{ |
|
34
|
1 |
|
foreach ($this->notifiers as $notifier) { |
|
35
|
1 |
|
$notifier->onEndProcess($state, $step); |
|
36
|
|
|
} |
|
37
|
1 |
|
} |
|
38
|
|
|
|
|
39
|
1 |
|
public function onStartIterableProcess(ProcessState $state, StepInterface $step) |
|
40
|
|
|
{ |
|
41
|
1 |
|
foreach ($this->notifiers as $notifier) { |
|
42
|
1 |
|
$notifier->onStartIterableProcess($state, $step); |
|
43
|
|
|
} |
|
44
|
1 |
|
} |
|
45
|
|
|
|
|
46
|
1 |
|
public function onUpdateIterableProcess(ProcessState $state, StepInterface $step) |
|
47
|
|
|
{ |
|
48
|
1 |
|
foreach ($this->notifiers as $notifier) { |
|
49
|
1 |
|
$notifier->onUpdateIterableProcess($state, $step); |
|
50
|
|
|
} |
|
51
|
1 |
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|