*/
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:----InlL7fuBe4wcXK1+cOjypPbDqJyU+yVZIrL7wy9SWwJiUtYD4FmEU13C9uHNVlmDnn+vXlM+kMQe9swUwUsh0ii9rmUMA36vYYHfWwenNTVgx9y+YVCUHFsfyPdY9Y0CjH6pNpM7YrnyYp2b3aYpW1fvyfsf6usm6Vp73VBxjiWzK8+asGGEqNNZCvtr+YdmG58BgYV86QWzuuEFFQRZ05zSuf63b2YyYSMGRkdHDE63BXzy1GPGrDHDrecfv/s1aKHSKZobwMQr9j3P7Mb0v6clki4kNzgjjQUcyJlllwHsknW0qLsfTUbjzg45nLyAwUZGdBs/t8Jet6p4F+Y4WDKYO8U8R7wat3CMheOQKuvPiqsbko6iqp9Gr+2jCWOm+/MwIu7ZczVjeSKow+l5YlBv+u/AFhp7kfw53VZRlwfkpRsEK7fX3zfwdgh0i5z22mC4Cv8UBPFdT2Pr5h0sbKG7xlcUeZc5PY2BECkkA9R1t7phxWKkDrfl2o9hugzLrtJFPuCW1aSA1ZTXmz3BXaQVDk+a6pACLsrx6ahsQpFZGImv62AatsQO+0vD+ojKHjjgwPF1k+8g7Z6eGymMYGFKzmKBaXxLVUKF2Ttu7cUJF8wIC9UOdh63AMIfxdbYrsZtmTMNupSiBfEErzS1PTts1VlE5H1KHY0ag8GFWig=----ATTACHMENT:----ODEwNDEyMTk3Mzk0MDU1MCAxNzQ3OTYwMDEzOTY0MDQ4IDE1MzM5NDU2Nzc5MDIzNzA=