/var/www/vhosts/ihelp.ro/httpdocs/vendor/composer/composer/src/Composer/Command
NameSizeModeActions
AboutCommand.php13070644editdlrm
ArchiveCommand.php86990644editdlrm
AuditCommand.php33910644editdlrm
BaseCommand.php152790644editdlrm
BaseDependencyCommand.php110390644editdlrm
BumpCommand.php98520644editdlrm
CheckPlatformReqsCommand.php90490644editdlrm
ClearCacheCommand.php34560644editdlrm
CompletionTrait.php81100644editdlrm
ConfigCommand.php427550644editdlrm
CreateProjectCommand.php245870644editdlrm
DependsCommand.php19280644editdlrm
DiagnoseCommand.php288190644editdlrm
DumpAutoloadCommand.php58860644editdlrm
ExecCommand.php47350644editdlrm
FundCommand.php54620644editdlrm
GlobalCommand.php56660644editdlrm
HomeCommand.php55350644editdlrm
InitCommand.php237950644editdlrm
InstallCommand.php81940644editdlrm
LicensesCommand.php59260644editdlrm
OutdatedCommand.php55570644editdlrm
PackageDiscoveryTrait.php211700644editdlrm
ProhibitsCommand.php21040644editdlrm
ReinstallCommand.php83240644editdlrm
RemoveCommand.php153690644editdlrm
RequireCommand.php299970644editdlrm
RunScriptCommand.php64410644editdlrm
ScriptAliasCommand.php24790644editdlrm
SearchCommand.php51200644editdlrm
SelfUpdateCommand.php271560644editdlrm
ShowCommand.php628080644editdlrm
StatusCommand.php86530644editdlrm
SuggestsCommand.php40660644editdlrm
UpdateCommand.php165320644editdlrm
ValidateCommand.php95650644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/composer/composer/src/Composer/Command/GlobalCommand.php (5666B)
* Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Command; use Composer\Factory; use Composer\Pcre\Preg; use Composer\Util\Filesystem; use Composer\Util\Platform; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Input\InputInterface; use Composer\Console\Input\InputArgument; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; /** * @author Jordi Boggiano */ class GlobalCommand extends BaseCommand { public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { $application = $this->getApplication(); if ($input->mustSuggestArgumentValuesFor('command-name')) { $suggestions->suggestValues(array_values(array_filter(array_map(static function (Command $command) { return $command->isHidden() ? null : $command->getName(); }, $application->all())))); return; } if ($application->has($commandName = $input->getArgument('command-name'))) { $input = $this->prepareSubcommandInput($input, true); $input = CompletionInput::fromString($input->__toString(), 2); $command = $application->find($commandName); $command->mergeApplicationDefinition(); $input->bind($command->getDefinition()); $command->complete($input, $suggestions); } } protected function configure(): void { $this ->setName('global') ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME)') ->setDefinition([ new InputArgument('command-name', InputArgument::REQUIRED, ''), new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''), ]) ->setHelp( <<\AppData\Roaming\Composer on Windows and /home//.composer on unix systems. If your system uses freedesktop.org standards, then it will first check XDG_CONFIG_HOME or default to /home//.config/composer Note: This path may vary depending on customizations to bin-dir in composer.json or the environmental variable COMPOSER_BIN_DIR. Read more at https://getcomposer.org/doc/03-cli.md#global EOT ) ; } /** * @throws \Symfony\Component\Console\Exception\ExceptionInterface */ public function run(InputInterface $input, OutputInterface $output): int { // 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)); } // extract real command name $tokens = Preg::split('{\s+}', $input->__toString()); $args = []; foreach ($tokens as $token) { if ($token && $token[0] !== '-') { $args[] = $token; if (count($args) >= 2) { break; } } } // show help for this command if no command was found if (count($args) < 2) { return parent::run($input, $output); } $input = $this->prepareSubcommandInput($input); return $this->getApplication()->run($input, $output); } private function prepareSubcommandInput(InputInterface $input, bool $quiet = false): StringInput { // 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)); } // The COMPOSER env var should not apply to the global execution scope if (Platform::getEnv('COMPOSER')) { Platform::clearEnv('COMPOSER'); } // change to global dir $config = Factory::createConfig(); $home = $config->get('home'); if (!is_dir($home)) { $fs = new Filesystem(); $fs->ensureDirectoryExists($home); if (!is_dir($home)) { throw new \RuntimeException('Could not create home directory'); } } try { chdir($home); } catch (\Exception $e) { throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e); } if (!$quiet) { $this->getIO()->writeError('Changed current directory to '.$home.''); } // create new input without "global" command prefix $input = new StringInput(Preg::replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1)); $this->getApplication()->resetComposer(); return $input; } /** * @inheritDoc */ public function isProxyCommand(): bool { return true; } }