AsyncActionExecutor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 6 1
1
<?php
2
namespace Workana\AsyncJobs\Executor;
3
4
use Workana\AsyncJobs\AsyncAction;
5
use Interop\Container\ContainerInterface;
6
7
/**
8
 * Async action executor
9
 *
10
 * @author Carlos Frutos <[email protected]>
11
 */
12
class AsyncActionExecutor
13
{
14
    /**
15
     * @var ContainerInterface
16
     */
17
    protected $container;
18
19
    /**
20
     * Creates a new instance
21
     *
22
     * @param ContainerInterface $container
23
     */
24
    public function __construct(ContainerInterface $container)
25
    {
26
        $this->container = $container;
27
    }
28
29
    /**
30
     * Executes the specified action
31
     *
32
     * @param AsyncAction $action
33
     *
34
     * @return void
35
     */
36
    public function __invoke(AsyncAction $action)
37
    {
38
        $target = $this->container->get($action->getClass());
39
40
        call_user_func_array([$target, $action->getMethod()], $action->getParameterValues());
41
    }
42
}