Executable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setExecutable() 0 6 1
A execute() 0 10 2
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2015-07-05 
5
 */
6
7
namespace Net\Bazzline\Component\Cli\Readline\Configuration;
8
9
use Closure;
10
use Net\Bazzline\Component\GenericAgreement\Exception\ExceptionInterface;
11
use Net\Bazzline\Component\GenericAgreement\Process\ExecutableInterface;
12
13
class Executable implements ExecutableInterface
14
{
15
    /** @var string|array|Closure */
16
    private $executable;
17
18
    /**
19
     * @param string|array $arrayOrString
20
     * @return $this
21
     */
22
    public function setExecutable($arrayOrString)
23
    {
24
        $this->executable = $arrayOrString;
25
26
        return $this;
27
    }
28
29
    /**
30
     * @param mixed $data
31
     * @return mixed
32
     * @throws ExceptionInterface
33
     */
34
    public function execute($data)
35
    {
36
        $executable = $this->executable;
37
38
        if (is_null($data)) {
39
            call_user_func($executable);
40
        } else {
41
            call_user_func_array($executable, $data);
42
        }
43
    }
44
}