note($message); } protected static function getProjectFolder(Event $event): string { $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); return realpath($vendorDir . '/../'); } /** * Execute a command in the CLI, as a separate process. */ public static function run(string $command): int { // Execute the command and show the output. passthru($command, $result); return $result; } /** * Create SymfonyStyle object. Taken from Symplify (which we might not * have at our disposal inside a 'project' installation) */ public static function createSymfonyStyle(): SymfonyStyle { // to prevent missing argv indexes if (! isset($_SERVER['argv'])) { $_SERVER['argv'] = []; } $argvInput = new ArgvInput(); $consoleOutput = new ConsoleOutput(); // --debug is called if ($argvInput->hasParameterOption('--debug')) { $consoleOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG); } return new SymfonyStyle($argvInput, $consoleOutput); } }