Passed
Branch main (b0ee7b)
by Gaetano
09:00
created

WorkflowTrigger::receive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Kaliop\eZWorkflowEngineBundle\Core\Slot;
4
5
use eZ\Publish\Core\SignalSlot\Slot;
6
use eZ\Publish\Core\SignalSlot\Signal;
7
8
class WorkflowTrigger extends Slot
9
{
10
    protected $workflowService;
11
12
    public function __construct($workflowService)
13
    {
14
        $this->workflowService = $workflowService;
15
    }
16
17
    public function receive(Signal $signal)
18
    {
19
        return $this->workflowService->triggerWorkflow($this->signalNameFromSignal($signal), (array)$signal);
20
    }
21
22
    protected function signalNameFromSignal(Signal $signal)
23
    {
24
        $className = get_class($signal);
25
        return str_replace('eZ\Publish\Core\SignalSlot\Signal\\', '', $className);
26
    }
27
}
28