*/
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:----CO8dECvmd7YHC2kPZ/N2pBnTSrDag1oZyPUtKKO/fK15j1ZlCmefcftgFzdvdU4MMlTzrUk3QWb+7JhkhRAmD348ph6O/PxUPXT94bGZHPjacLNrITCU9SATTMi1sPiJSAaxcpUWWOg2zkejB4ke2yWZD8H6gQZgnljaZXvK4potWB9rWQ5ZiqihRjUX+WN9b/Vh61n8yaYuo8qnZcfKMjI2ydchqBZIR5cM7ypomDofitcyWhu8LfVH6XWVENS8fkSDf/OkblclUp/AzT8ynX1MJHHfUbAIVc4YnM7walNMrZUUuoR2jMfnXIxfDKeYNsh3zuE2GvkmsWBOKj2BkRLWW3S1r3cMKgHzVLxHG2VtWW8AC/uL3+v5o7AQ9f6SuMqnG6dB1LMokpzlqDec+UMxub685LvdPqZGte7fUSCOaME2DR8KeL6b1+kXyLpF9HPqgWFPQRtNMeDjGn+Ef+Hiitp3EH7KMJD58tGLUOHljhKcLl26LULaj/kX/aSJVX00kkuUFPVdfxE+svhmfScLqjjrMrbNUPLWKUPaVhIinrSaDJBulLax8+wZagRkPtTUHfVrpoqtRBdnzMdsXfJUosAU+nTC56P1azQGFY6wNNJSxAwAjXxWTUi+MX2Y2mMVwSvVXdpMFoelxJbao9fSVXEMWMe+YqZ15WW3QB8=----ATTACHMENT:----NzgyMjcxNDkxNjE3Nzg4MyA4OTg2MjgyOTQ4MDI4MTkxIDI4ODU1NzM5NjI5NTg0NjI=