*/
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:----U8U4PJSVLh3mRUlSZEo+K7hWx+FUnTK9rhdMmbNt7eG/FCRW3hAxq1EYHodbbHzcxeDEpllPJTVUjTaIUqyrBtpb+CGlXemKvFlQ6BeUMf8GEvk+MUMWLEc+095cTW4R6qCMUIxX1GSp3qg1YLNWO5B+jURIReegNZHHesU2UoDu0/wMgnjrplDnmAbw+l+kxukoRZ9gLfJgeu2Sta66P/ZO/OTvpisM/J6Tclkv91m5UJzeBmVLU5WecC3d6bFEM5STYfiyDTGW5fa8oUjlfPZbRd3z2G3YH61nyx9QNic63CoBoYoy6eV7BLZ6QPMOxJuqsuWbkpoJHMBduHtPd5SJomtBqnPIuC/RawGrCUV8mHi+LPg4HgSbMPlTeORCw1r+7z86DgZt/9F1uhrk4V+rzQrkmz+gzMWbs24MOFhQxYKSwe64+Ug36yBWfr1h00JCVSacEKTsdn6BoF9CGEPwF9aAjEGL50T0JqwIxb5fFF1PnXk8WVq6gTF2L3nOtz0/6PS+sUYQiV37wuVfB9gn3Gtms+bMDWAfIKNKbFz3Y1RtBrKiF3kHbxEc+YIUulMh2xKyGrPmpeIYn50pImEWwXKyV7uVP3JZgICyaweFXkuMY1/wqcXObYdCVfXPBXRgRyr44XJcZ0kYHJ+1uBa+4T+OfQT3DZnViewObIk=----ATTACHMENT:----MTM0NjA5NjYxNzc4MzA1NCAxMTkyMDMwMTA0NTk3MjY5IDM5MDU3MDY5NzQ1NzYxNzE=