| 1 | <?php |
||
| 8 | class ExecuteCode extends ActionAbstract |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | protected $description; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var callable |
||
| 17 | */ |
||
| 18 | protected $callback; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Executes the passed callback, function or static method. |
||
| 22 | * |
||
| 23 | * @param string $description Description of the intention of the callback |
||
| 24 | * @param callable $callback The callback to execute. It will receive $config, $input and $output as parameters |
||
| 25 | */ |
||
| 26 | 1 | public function __construct($description, $callback) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | 1 | public function getName() |
|
| 36 | { |
||
| 37 | 1 | return ($this->description ?: 'Execute Custom Code') . ' (ExecuteCode)'; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | 1 | public function isSupported() |
|
| 44 | { |
||
| 45 | 1 | return true; // no special dependencies |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 1 | public function execute(InputInterface $input, OutputInterface $output) |
|
| 55 | } |
||
| 56 |