Failed Conditions
Pull Request — 0.3 (#20)
by jean
12:27
created

ChainProcessNotifier::onExecutedProcess()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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