| 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 array |
||
| 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 | 21 | public function __construct($type, $action, $options = []) |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Type getter. |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | 1 | public function getType() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * Action getter. |
||
| 80 | * |
||
| 81 | * @return string |
||
| 82 | */ |
||
| 83 | 1 | public function getAction() |
|
| 87 | |||
| 88 | /** |
||
| 89 | * Return option map. |
||
| 90 | * |
||
| 91 | * @return array |
||
| 92 | */ |
||
| 93 | 4 | public function getOptions() |
|
| 97 | |||
| 98 | /** |
||
| 99 | * Return config data. |
||
| 100 | * |
||
| 101 | * @return array |
||
| 102 | */ |
||
| 103 | 2 | public function getJsonData() |
|
| 110 | } |
||
| 111 |