/
var
/
www
/
vhosts
/
ihelp.ro
/
httpdocs
/
vendor
/
composer
/
composer
/
src
/
Composer
/
Command
/
/var/www/vhosts/ihelp.ro/httpdocs/vendor/composer/composer/src/Composer/Command
mkdir
upload
Name
Size
Mode
Actions
AboutCommand.php
1307
0644
edit
dl
rm
ArchiveCommand.php
8699
0644
edit
dl
rm
AuditCommand.php
3391
0644
edit
dl
rm
BaseCommand.php
15279
0644
edit
dl
rm
BaseDependencyCommand.php
11039
0644
edit
dl
rm
BumpCommand.php
9852
0644
edit
dl
rm
CheckPlatformReqsCommand.php
9049
0644
edit
dl
rm
ClearCacheCommand.php
3456
0644
edit
dl
rm
CompletionTrait.php
8110
0644
edit
dl
rm
ConfigCommand.php
42755
0644
edit
dl
rm
CreateProjectCommand.php
24587
0644
edit
dl
rm
DependsCommand.php
1928
0644
edit
dl
rm
DiagnoseCommand.php
28819
0644
edit
dl
rm
DumpAutoloadCommand.php
5886
0644
edit
dl
rm
ExecCommand.php
4735
0644
edit
dl
rm
FundCommand.php
5462
0644
edit
dl
rm
GlobalCommand.php
5666
0644
edit
dl
rm
HomeCommand.php
5535
0644
edit
dl
rm
InitCommand.php
23795
0644
edit
dl
rm
InstallCommand.php
8194
0644
edit
dl
rm
LicensesCommand.php
5926
0644
edit
dl
rm
OutdatedCommand.php
5557
0644
edit
dl
rm
PackageDiscoveryTrait.php
21170
0644
edit
dl
rm
ProhibitsCommand.php
2104
0644
edit
dl
rm
ReinstallCommand.php
8324
0644
edit
dl
rm
RemoveCommand.php
15369
0644
edit
dl
rm
RequireCommand.php
29997
0644
edit
dl
rm
RunScriptCommand.php
6441
0644
edit
dl
rm
ScriptAliasCommand.php
2479
0644
edit
dl
rm
SearchCommand.php
5120
0644
edit
dl
rm
SelfUpdateCommand.php
27156
0644
edit
dl
rm
ShowCommand.php
62808
0644
edit
dl
rm
StatusCommand.php
8653
0644
edit
dl
rm
SuggestsCommand.php
4066
0644
edit
dl
rm
UpdateCommand.php
16532
0644
edit
dl
rm
ValidateCommand.php
9565
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/httpdocs/vendor/composer/composer/src/Composer/Command/SearchCommand.php
(5120B)
<?php declare(strict_types=1); /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * 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\Json\JsonFile; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Composer\Console\Input\InputArgument; use Composer\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Composer\Repository\CompositeRepository; use Composer\Repository\PlatformRepository; use Composer\Repository\RepositoryInterface; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; /** * @author Robert Schönthal <seroscho@googlemail.com> */ class SearchCommand extends BaseCommand { protected function configure(): void { $this ->setName('search') ->setDescription('Searches for packages') ->setDefinition([ new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'), new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'), new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']), new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'), ]) ->setHelp( <<<EOT The search command searches for packages by its name <info>php composer.phar search symfony composer</info> Read more at https://getcomposer.org/doc/03-cli.md#search EOT ) ; } protected function execute(InputInterface $input, OutputInterface $output): int { // init repos $platformRepo = new PlatformRepository; $io = $this->getIO(); $format = $input->getOption('format'); if (!in_array($format, ['text', 'json'])) { $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format)); return 1; } if (!($composer = $this->tryComposer())) { $composer = Factory::create($this->getIO(), [], $input->hasParameterOption('--no-plugins')); } $localRepo = $composer->getRepositoryManager()->getLocalRepository(); $installedRepo = new CompositeRepository([$localRepo, $platformRepo]); $repos = new CompositeRepository(array_merge([$installedRepo], $composer->getRepositoryManager()->getRepositories())); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output); $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $mode = RepositoryInterface::SEARCH_FULLTEXT; if ($input->getOption('only-name') === true) { if ($input->getOption('only-vendor') === true) { throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together'); } $mode = RepositoryInterface::SEARCH_NAME; } elseif ($input->getOption('only-vendor') === true) { $mode = RepositoryInterface::SEARCH_VENDOR; } $type = $input->getOption('type'); $query = implode(' ', $input->getArgument('tokens')); if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) { $query = preg_quote($query); } $results = $repos->search($query, $mode, $type); if (\count($results) > 0 && $format === 'text') { $width = $this->getTerminalWidth(); $nameLength = 0; foreach ($results as $result) { $nameLength = max(strlen($result['name']), $nameLength); } $nameLength += 1; foreach ($results as $result) { $description = $result['description'] ?? ''; $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : ''; $remaining = $width - $nameLength - strlen($warning) - 2; if (strlen($description) > $remaining) { $description = substr($description, 0, $remaining - 3) . '...'; } $link = $result['url'] ?? null; if ($link !== null) { $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description); } else { $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description); } } } elseif ($format === 'json') { $io->write(JsonFile::encode($results)); } return 0; } }
Save
cmd:
run