1 | <?php |
||
20 | class Action |
||
21 | { |
||
22 | /** |
||
23 | * Action type |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $type; |
||
28 | |||
29 | /** |
||
30 | * Action phpc lass or cli script |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | private $action; |
||
35 | |||
36 | /** |
||
37 | * Map of options name => value |
||
38 | * |
||
39 | * @var \SebastianFeldmann\CaptainHook\Config\Options |
||
40 | */ |
||
41 | private $options; |
||
42 | |||
43 | /** |
||
44 | * List of valid action types |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected static $validTypes = ['php' => true, 'cli' => true]; |
||
49 | |||
50 | /** |
||
51 | * Action constructor. |
||
52 | * |
||
53 | * @param string $type |
||
54 | * @param string $action |
||
55 | * @param array $options |
||
56 | * @throws \Exception |
||
57 | */ |
||
58 | 33 | public function __construct(string $type, string $action, array $options = []) |
|
67 | |||
68 | /** |
||
69 | * Type getter. |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | 1 | public function getType() : string |
|
77 | |||
78 | /** |
||
79 | * Action getter. |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 1 | public function getAction() : string |
|
87 | |||
88 | /** |
||
89 | * Return option map. |
||
90 | * |
||
91 | * @return \SebastianFeldmann\CaptainHook\Config\Options |
||
92 | */ |
||
93 | 16 | public function getOptions() : Options |
|
97 | |||
98 | /** |
||
99 | * Return config data. |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | 2 | public function getJsonData() : array |
|
110 | } |
||
111 |