Completed
Push — master ( ca4c8c...687844 )
by Sebastian
03:10
created

Condition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 58
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getJsonData() 0 5 1
A __construct() 0 4 1
A getArgs() 0 3 1
A getExec() 0 3 1
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace CaptainHook\App\Config;
11
12
/**
13
 * Class Action
14
 *
15
 * @package CaptainHook
16
 * @author  Sebastian Feldmann <[email protected]>
17
 * @link    https://github.com/captainhookphp/captainhook
18
 * @since   Class available since Release 4.2.0
19
 */
20
class Condition
21
{
22
    /**
23
     * Condition executable
24
     *
25
     * @var string
26
     */
27
    private $exec;
28
29
    /**
30
     * Condition arguments
31
     *
32
     * @var array
33
     */
34
    private $args;
35
36
    /**
37
     * Condition constructor
38
     *
39
     * @param string $exec
40
     * @param array  $args
41
     */
42 10
    public function __construct(string $exec, array $args = [])
43
    {
44 10
        $this->exec = $exec;
45 10
        $this->args = $args;
46 10
    }
47
48
    /**
49
     * Exec getter
50
     *
51
     * @return string
52
     */
53 6
    public function getExec() : string
54
    {
55 6
        return $this->exec;
56
    }
57
58
    /**
59
     * Args getter
60
     *
61
     * @return array
62
     */
63 2
    public function getArgs() : array
64
    {
65 2
        return $this->args;
66
    }
67
68
    /**
69
     * Return config data
70
     *
71
     * @return array
72
     */
73 1
    public function getJsonData() : array
74
    {
75
        return [
76 1
            'exec' => $this->exec,
77 1
            'args' => $this->args,
78
        ];
79
    }
80
}
81