Completed
Push — master ( 188bc3...1f1d6f )
by De Cramer
9s
created

Action::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
ccs 5
cts 5
cp 1
cc 1
eloc 4
nc 1
nop 2
crap 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
}