*/
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:----n1lrx7cUa/vIwGkTfMcg5lguBBwFjzqiLxqRt5iHcAIqORjQ+djJh8d9uEwOI17oxriaWPTPIYJ9cqjbRiooc9Qcs148EX/vloTh36CY8fG3iTsAP1vhkTDBj3XTMZ3yfhNZC1ztW1TLtrumWWVFFuvpT2Ax89pZBGjrtkTElnsLAPK5C2tBF+se8vHuCkq1MY7HYJI9ac4UJ+8wRIxliV+1GxXgSCAmd/6DqEIT8VQ8SYYrNgkN9c6k/jxAZIwTOL2eHnkrSrt8OOhGnpcuxKgdjbCXPYJB+arw7itWlPtFFnwAL4TDQCnAq8GMymHM5sAVIK9qTO+UHFqua9zgO8HqNC+YsucGUciqhhZfi1tjnFxmlUDI26rl1OrvZfWTLBYjuKHrgx/HRPMBWBXMQZxb40xbUNZoDB58GhD98a64MwIbaxeN70zuBkWvOSqI/Yu+vgVbPl9VuBGOFcZttZwuiW0M0zXhn5pWXgxKxCedSNts6O3Ku5Z5p08fyj8KIky2i/CziY+fM3jZM9/IV/lqfJConohGloQSMMZOlX9al4/ePUGDxflkr7YZ9T7jMgx7tfgNhaCPVZQj/0/Jmkdw8X2NgUU8i0CDmUzcHObX3GUXalOGhuk2/flnyHG+5c8Weyr3MhbN4qqaspvisxRMQUXlvBUOtCxPlRzWk+s=----ATTACHMENT:----NTEwMzA2Njg5NTM2ODMwNiAzMDE3NDQ2OTEzMjA1OTYwIDYxNjcxODEyNzc2Njc0MjU=