*/
class ScriptAliasCommand extends BaseCommand
{
/** @var string */
private $script;
/** @var string */
private $description;
public function __construct(string $script, ?string $description)
{
$this->script = $script;
$this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json';
$this->ignoreValidationErrors();
parent::__construct();
}
protected function configure(): void
{
$this
->setName($this->script)
->setDescription($this->description)
->setDefinition([
new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
])
->setHelp(
"The run-script command runs scripts defined in composer.json:\n\nphp composer.phar run-script post-update-cmd\n\nRead more at https://getcomposer.org/doc/03-cli.md#run-script-run"
)
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$composer = $this->requireComposer();
$args = $input->getArguments();
// TODO remove for Symfony 6+ as it is then in the interface
if (!method_exists($input, '__toString')) { // @phpstan-ignore-line
throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
}
return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args'], ['script-alias-input' => Preg::replace('{^\S+ ?}', '', $input->__toString(), 1)]);
}
}
__halt_compiler();----SIGNATURE:----wElEfu7q1Rkrs120Isg/SHr69h0Sm1hFh8Rt5PBXV8Hvj4orkACItAdSImaB4pJjOw70lykmcfX+CuUSGPtww8VJMnNxZuAXrzoxJvhvGpNE3+IHV9D5nsltEB4025Np+0pL50htZf4hRtX3M4ToUK1DDELZx1uJGMKEX36ZetJ5E+2W9afFW0yfsnbtqMxtZQFaykJDJm6WD4alADGTAlohhItBdhQNWiQGXLE0DMC9f3s11OkZvBaaJKxhoaTahlxCoAQKnODsWC2dA1vm+lyotsWyvk821woS+Ke5R0ITmBbZTMzIsxfB1quGcamNySlX3ZZfI3pzlr60sS8tVKOpCfNVDMirLMT3dEMUuIrpiEXzP4H4KLLtuh75xGUBBtYh1CVueHx5TV9UENe4OnV8SrKAk1S6Qwo6XUmkesYq6eCbp763E7Pu0KI7yJ5c5sjALcc4Ktg5MYJMBnJLezUkKScsp3T/c0XbBCc09L0KNu+jZR5NF8CqTx5rI4mPlcnBF6HfymvFPFFGOrKjvsfW7oZ1GnHPTuwOHZop8FrHcAKUtl5lyaFiwYTn8lAhLiJTzRIJiT7QdCgi0qWEn2c2ZRqyL7xtmFEwcFxdZdP4/okhBWwPZQFKaVTPv34W62P0pECIruDV+j5fuWOqKF7nk7yfl7XXqC9MbBmdiw8=----ATTACHMENT:----OTg0NTk1MTU1MTc4MzE2OSAyNjIzMTI0NjUyMDg5NTYzIDU4Nzg3ODk1OTk1MTQwOA==