Condition   A
last analyzed

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