|
9 | 9 |
|
10 | 10 | use Elements\Bundle\ProcessManagerBundle\ExecutionTrait;
|
11 | 11 | use Elements\Bundle\ProcessManagerBundle\Model\Configuration;
|
12 |
| -use Exception; |
13 | 12 | use Pimcore\Console\Application;
|
14 | 13 | use Symfony\Component\Console\Command\Command;
|
15 | 14 | use Symfony\Component\Console\Command\LazyCommand;
|
@@ -42,19 +41,17 @@ public function __construct(string $strategy = 'default', array $whiteList = [],
|
42 | 41 | $this->setBlackList($blackList);
|
43 | 42 | }
|
44 | 43 |
|
45 |
| - public function validateCommandConfiguration(LazyCommand | Command $command, Configuration $configuration): void |
| 44 | + public function validateCommandConfiguration(LazyCommand|Command $command, Configuration $configuration): void |
46 | 45 | {
|
47 | 46 |
|
48 | 47 | $settings = $configuration->getExecutorSettingsAsArray();
|
49 | 48 | $values = $settings['values'];
|
50 | 49 |
|
51 | 50 | $commandOptions = $values['commandOptions'] ?? '';
|
52 | 51 |
|
53 |
| - //Todo: check if command options are valid |
54 |
| - //and throw an error if they are not valid |
55 |
| - |
56 |
| - // throw new Exception('Command options are not valid'); |
57 |
| - |
| 52 | + if (is_callable([$command, 'validatedCommandOptions'])) { |
| 53 | + $command->validatedCommandOptions($commandOptions, $configuration); |
| 54 | + } |
58 | 55 | }
|
59 | 56 |
|
60 | 57 | /**
|
@@ -116,7 +113,7 @@ protected function getCommandsDefault(array $commands): array
|
116 | 113 | /**
|
117 | 114 | * @return array<string>
|
118 | 115 | */
|
119 |
| - protected function classUsesTraits(LazyCommand | Command $class, bool $autoload = true): array |
| 116 | + protected function classUsesTraits(LazyCommand|Command $class, bool $autoload = true): array |
120 | 117 | {
|
121 | 118 | if ($class instanceof LazyCommand) {
|
122 | 119 | $class = $class->getCommand();
|
|
0 commit comments