Completed
Pull Request — master (#36)
by De Cramer
02:15
created

Action   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 30
c 0
b 0
f 0
rs 10
ccs 10
cts 10
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A execute() 0 4 1
1
<?php
2
3
namespace eXpansion\Core\Model\Gui;
4
5
class Action
6
{
7
    protected $id;
8
9
    protected $callable;
10
11
    protected $args;
12
13
    /**
14
     * Action constructor.
15
     * @param $callable
16
     * @param $args
17
     */
18 2
    public function __construct($callable, $args)
19
    {
20 2
        $this->id = spl_object_hash($this);
21 2
        $this->callable = $callable;
22 2
        $this->args = $args;
23 2
    }
24
25 2
    public function getId()
26
    {
27 2
        return $this->id;
28
    }
29
30 1
    public function execute($login, $answerValues)
31
    {
32 1
        call_user_func_array($this->callable, [$login, $answerValues, $this->args]);
33
    }
34
}