本文整理汇总了PHP中Composer\IO\IOInterface::isVeryVerbose方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::isVeryVerbose方法的具体用法?PHP IOInterface::isVeryVerbose怎么用?PHP IOInterface::isVeryVerbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\IO\IOInterface
的用法示例。
在下文中一共展示了IOInterface::isVeryVerbose方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debug
/**
* Log a debug message
*
* Messages will be output at the "very verbose" logging level (eg `-vv`
* needed on the Composer command).
*
* @param string $message
*/
public function debug($message)
{
if ($this->inputOutput->isVeryVerbose()) {
$message = " <info>[{$this->name}]</info> {$message}";
$this->log($message);
}
}
示例2: writePatchNotice
/**
* Write a notice to IO
*
* @param string $action
* @param \Netresearch\Composer\Patches\Patch $patch
* @param \Composer\Package\PackageInterface $package
* @param \Netresearch\Composer\Patches\Exception $exception
*/
protected function writePatchNotice($action, Patch $patch, PackageInterface $package, $exception = null)
{
$adverbMap = array('test' => 'on', 'apply' => 'to', 'revert' => 'from');
if ($action == 'test' && !$this->io->isVeryVerbose()) {
return;
}
$msg = ' ' . ucfirst($action) . 'ing patch';
if ($this->io->isVerbose() || !isset($patch->title)) {
$msg .= ' <info>' . $patch->getChecksum() . '</info>';
}
$msg .= ' ' . $adverbMap[$action];
$msg .= ' <info>' . $package->getName() . '</info>';
if ($this->io->isVerbose()) {
' (<comment>' . $package->getPrettyVersion() . '</comment>)';
}
if (isset($patch->title)) {
$msg .= ': <comment>' . $patch->title . '</comment>';
}
$this->io->write($msg);
if ($exception) {
$this->io->write(' <warning>Could not ' . $action . ' patch</warning>' . ($action == 'revert' ? ' (was probably not applied)' : ''));
if ($this->io->isVerbose()) {
$this->io->write('<warning>' . $exception->getMessage() . '</warning>');
}
}
}
示例3: runGrumPhpCommand
/**
* Run the GrumPHP console to (de)init the git hooks
*
* @param $command
*/
protected function runGrumPhpCommand($command)
{
$config = $this->composer->getConfig();
$baseDir = $this->getObjectProtectedProperty($config, 'baseDir');
$configFilename = !empty($config->get('extra')['grumphp']['config-default-path']) ? $config->get('extra')['grumphp']['config-default-path'] : $baseDir . DIRECTORY_SEPARATOR . 'grumphp.yml';
if (!file_exists($configFilename)) {
// Check executable which is running:
if ($this->io->isVeryVerbose()) {
$this->io->write(sprintf('<fg=red>File "%s" not found</fg=red>', $configFilename));
}
return;
}
$application = new \Octava\GeggsApplication();
/** @var Config $config */
$config = $application->getContainer()->get('octava_geggs.config');
$grumPhpConfigData = Yaml::parse(file_get_contents($configFilename));
$fileSystem = new Filesystem();
foreach ($config->getVendorDirs() as $item) {
$grumPhpConfigData['bin_dir'] = '../../../bin';
$grumPhpConfigYml = Yaml::dump($grumPhpConfigData);
$vendorConfigFilename = implode(DIRECTORY_SEPARATOR, [$item, 'vendor', 'grumphp.yml']);
$fileSystem->dumpFile($vendorConfigFilename, $grumPhpConfigYml);
$gitPreCommitFilename = implode(DIRECTORY_SEPARATOR, [$item, '.git', 'hooks', 'pre-commit']);
$fileSystem->dumpFile($gitPreCommitFilename, $this->generatePreCommit($vendorConfigFilename));
$gitCommitMsgFilename = implode(DIRECTORY_SEPARATOR, [$item, '.git', 'hooks', 'commit-msg']);
$fileSystem->dumpFile($gitCommitMsgFilename, $this->generateCommitMsg($vendorConfigFilename));
if ($this->io->isVeryVerbose()) {
$this->io->write(sprintf('Config created %s', $vendorConfigFilename));
$this->io->write(sprintf('Pre commit hook created %s', $gitPreCommitFilename));
$this->io->write(sprintf('Commit msg hook created %s', $gitCommitMsgFilename));
}
}
$this->io->write('<fg=yellow>GrumPHP is sniffing your vendors code!</fg=yellow>');
}
示例4: __construct
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
{
$this->drivers = $drivers ?: array('github' => 'Composer\\Repository\\Vcs\\GitHubDriver', 'gitlab' => 'Composer\\Repository\\Vcs\\GitLabDriver', 'git-bitbucket' => 'Composer\\Repository\\Vcs\\GitBitbucketDriver', 'git' => 'Composer\\Repository\\Vcs\\GitDriver', 'hg-bitbucket' => 'Composer\\Repository\\Vcs\\HgBitbucketDriver', 'hg' => 'Composer\\Repository\\Vcs\\HgDriver', 'perforce' => 'Composer\\Repository\\Vcs\\PerforceDriver', 'svn' => 'Composer\\Repository\\Vcs\\SvnDriver');
$this->url = $repoConfig['url'];
$this->io = $io;
$this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
$this->verbose = $io->isVeryVerbose();
$this->config = $config;
$this->repoConfig = $repoConfig;
}
示例5: linkBootstrapFiles
/**
* Symlink the bootstrapping code into the .git folder.
*
* @since 0.1.0
*
* @param Filesystem $filesystem Reference to the Filesystem instance.
*/
protected function linkBootstrapFiles(Filesystem $filesystem)
{
$rootTemplate = Paths::getPath('root_template');
$composterTemplate = Paths::getPath('git_template');
$files = array('bootstrap.php');
foreach ($files as $file) {
if (static::$io->isVeryVerbose()) {
static::$io->write(sprintf(_('Symlinking %1$s to %2$s'), $rootTemplate . $file, $composterTemplate . $file));
}
$filesystem->relativeSymlink($composterTemplate . $file, $rootTemplate . $file);
}
}
示例6: dumpVulnerabilities
/**
* @param IOInterface $io
* @param array $vulnerabilities
*/
protected static function dumpVulnerabilities(IOInterface $io, array $vulnerabilities)
{
foreach ($vulnerabilities as $package => $infos) {
$io->write("\n" . ' <info>' . $package . '</info> ' . $infos['version']);
foreach ($infos['advisories'] as $key => $advisory) {
$io->write(' <comment>' . $advisory['title'] . '</comment>');
$io->write(' <info>' . $advisory['link'] . '</info>');
if ($advisory['cve'] && $io->isVeryVerbose()) {
$io->write(' ' . $advisory['cve']);
}
}
}
$io->write("\n");
}
示例7: isGitDiff
/**
* Return TRUE if the current git branch has any uncommitted changes.
*
* @return bool
*/
protected function isGitDiff($branchName = '')
{
$output = '';
$command = "git diff";
if ($branchName) {
$command .= ' ' . $this->git['base-branch'] . ' ' . $branchName;
}
if ($this->executor->execute($command, $output) == 0) {
$output = trim($output);
if ($this->io->isVeryVerbose() && $output) {
$this->io->write("<comment>" . substr($output, 0, 10) . "...</comment>");
}
return $output ? TRUE : FALSE;
}
return FALSE;
}
示例8: runGrumPhpCommand
/**
* Run the GrumPHP console to (de)init the git hooks
*
* @param $command
*/
protected function runGrumPhpCommand($command)
{
$config = $this->composer->getConfig();
$commandLocator = new ExternalCommand($config->get('bin-dir'), new ExecutableFinder());
$executable = $commandLocator->locate('grumphp');
$builder = new ProcessBuilder(array($executable, $command, '--no-interaction'));
$process = $builder->getProcess();
// Check executable which is running:
if ($this->io->isVeryVerbose()) {
$this->io->write('Running process : ' . $process->getCommandLine());
}
$process->run();
if (!$process->isSuccessful()) {
$this->io->write('<fg=red>GrumPHP can not sniff your commits. Did you specify the correct git-dir?</fg=red>');
$this->io->write('<fg=red>' . $process->getErrorOutput() . '</fg=red>');
return;
}
$this->io->write('<fg=yellow>' . $process->getOutput() . '</fg=yellow>');
}
示例9: writePatchNotice
/**
* Write a notice to IO
*
* @param string $action
* @param \Netresearch\Composer\Patches\Patch $patch
* @param \Composer\Package\PackageInterface $package
*/
protected function writePatchNotice($action, Patch $patch, PackageInterface $package)
{
$adverbMap = array('test' => 'on', 'apply' => 'to', 'revert' => 'from');
if ($action == 'test' && !$this->io->isVeryVerbose()) {
return;
}
$msg = ' - ' . ucfirst($action) . 'ing patch';
if ($this->io->isVerbose() || !isset($patch->title)) {
$msg .= ' <info>' . $patch->getChecksum() . '</info>';
}
$msg .= ' ' . $adverbMap[$action];
$msg .= ' <info>' . $package->getName() . '</info>';
if ($this->io->isVerbose()) {
' (<comment>' . $package->getPrettyVersion() . '</comment>)';
}
if (isset($patch->title)) {
$msg .= ': <comment>' . $patch->title . '</comment>';
}
$this->io->write($msg);
}
示例10: doInstall
//.........这里部分代码省略.........
$this->io->writeError('<info>Installing dependencies' . ($withDevReqs ? ' (including require-dev)' : '') . '</info>');
if ($withDevReqs) {
$links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
} else {
$links = $this->package->getRequires();
}
foreach ($links as $link) {
$request->install($link->getTarget(), $link->getConstraint());
}
}
// force dev packages to have the latest links if we update or install from a (potentially new) lock
$this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-links');
// solve dependencies
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
$solver = new Solver($policy, $pool, $installedRepo);
try {
$operations = $solver->solve($request, $this->ignorePlatformReqs);
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
} catch (SolverProblemsException $e) {
$this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>');
$this->io->writeError($e->getMessage());
return max(1, $e->getCode());
}
// force dev packages to be updated if we update or install from a (potentially new) lock
$operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-updates', $operations);
// execute operations
if (!$operations) {
$this->io->writeError('Nothing to install or update');
}
$operations = $this->movePluginsToFront($operations);
$operations = $this->moveUninstallsToFront($operations);
foreach ($operations as $operation) {
// collect suggestions
if ('install' === $operation->getJobType()) {
foreach ($operation->getPackage()->getSuggests() as $target => $reason) {
$this->suggestedPackages[] = array('source' => $operation->getPackage()->getPrettyName(), 'target' => $target, 'reason' => $reason);
}
}
// not installing from lock, force dev packages' references if they're in root package refs
if (!$installFromLock) {
$package = null;
if ('update' === $operation->getJobType()) {
$package = $operation->getTargetPackage();
} elseif ('install' === $operation->getJobType()) {
$package = $operation->getPackage();
}
if ($package && $package->isDev()) {
$references = $this->package->getReferences();
if (isset($references[$package->getName()])) {
$package->setSourceReference($references[$package->getName()]);
$package->setDistReference($references[$package->getName()]);
}
}
if ('update' === $operation->getJobType() && $operation->getTargetPackage()->isDev() && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion() && $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference()) {
if ($this->io->isDebug()) {
$this->io->writeError(' - Skipping update of ' . $operation->getTargetPackage()->getPrettyName() . ' to the same reference-locked version');
$this->io->writeError('');
}
continue;
}
}
$event = 'Composer\\Installer\\PackageEvents::PRE_PACKAGE_' . strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
}
// output non-alias ops in dry run, output alias ops in debug verbosity
if ($this->dryRun && false === strpos($operation->getJobType(), 'Alias')) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError('');
} elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError('');
}
$this->installationManager->execute($localRepo, $operation);
// output reasons why the operation was ran, only for install/update operations
if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
$reason = $operation->getReason();
if ($reason instanceof Rule) {
switch ($reason->getReason()) {
case Rule::RULE_JOB_INSTALL:
$this->io->writeError(' REASON: Required by root: ' . $reason->getPrettyString($pool));
$this->io->writeError('');
break;
case Rule::RULE_PACKAGE_REQUIRES:
$this->io->writeError(' REASON: ' . $reason->getPrettyString($pool));
$this->io->writeError('');
break;
}
}
}
$event = 'Composer\\Installer\\PackageEvents::POST_PACKAGE_' . strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
}
if (!$this->dryRun) {
$localRepo->write();
}
}
return 0;
}
示例11: doInstall
//.........这里部分代码省略.........
// we also force them to be uninstalled if they are present in the local repo
if ($this->update) {
$devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
if (!$this->devMode) {
$operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
}
} else {
$devPackages = null;
}
if ($operations) {
$installs = $updates = $uninstalls = array();
foreach ($operations as $operation) {
if ($operation instanceof InstallOperation) {
$installs[] = $operation->getPackage()->getPrettyName() . ':' . $operation->getPackage()->getFullPrettyVersion();
} elseif ($operation instanceof UpdateOperation) {
$updates[] = $operation->getTargetPackage()->getPrettyName() . ':' . $operation->getTargetPackage()->getFullPrettyVersion();
} elseif ($operation instanceof UninstallOperation) {
$uninstalls[] = $operation->getPackage()->getPrettyName();
}
}
$this->io->writeError(sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>", count($installs), 1 === count($installs) ? '' : 's', count($updates), 1 === count($updates) ? '' : 's', count($uninstalls), 1 === count($uninstalls) ? '' : 's'));
if ($installs) {
$this->io->writeError("Installs: " . implode(', ', $installs), true, IOInterface::VERBOSE);
}
if ($updates) {
$this->io->writeError("Updates: " . implode(', ', $updates), true, IOInterface::VERBOSE);
}
if ($uninstalls) {
$this->io->writeError("Removals: " . implode(', ', $uninstalls), true, IOInterface::VERBOSE);
}
}
foreach ($operations as $operation) {
// collect suggestions
if ('install' === $operation->getJobType()) {
$this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
}
// updating, force dev packages' references if they're in root package refs
if ($this->update) {
$package = null;
if ('update' === $operation->getJobType()) {
$package = $operation->getTargetPackage();
} elseif ('install' === $operation->getJobType()) {
$package = $operation->getPackage();
}
if ($package && $package->isDev()) {
$references = $this->package->getReferences();
if (isset($references[$package->getName()])) {
$this->updateInstallReferences($package, $references[$package->getName()]);
}
}
if ('update' === $operation->getJobType() && $operation->getTargetPackage()->isDev() && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion() && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference()) && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())) {
$this->io->writeError(' - Skipping update of ' . $operation->getTargetPackage()->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
$this->io->writeError('', true, IOInterface::DEBUG);
continue;
}
}
$event = 'Composer\\Installer\\PackageEvents::PRE_PACKAGE_' . strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
}
// output non-alias ops in dry run, output alias ops in debug verbosity
if ($this->dryRun && false === strpos($operation->getJobType(), 'Alias')) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError('');
} elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
$this->io->writeError(' - ' . $operation);
$this->io->writeError('');
}
$this->installationManager->execute($localRepo, $operation);
// output reasons why the operation was ran, only for install/update operations
if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
$reason = $operation->getReason();
if ($reason instanceof Rule) {
switch ($reason->getReason()) {
case Rule::RULE_JOB_INSTALL:
$this->io->writeError(' REASON: Required by the root package: ' . $reason->getPrettyString($pool));
$this->io->writeError('');
break;
case Rule::RULE_PACKAGE_REQUIRES:
$this->io->writeError(' REASON: ' . $reason->getPrettyString($pool));
$this->io->writeError('');
break;
}
}
}
$event = 'Composer\\Installer\\PackageEvents::POST_PACKAGE_' . strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
}
if (!$this->dryRun) {
$localRepo->write();
}
}
if (!$this->dryRun) {
// force source/dist urls to be updated for all packages
$this->processPackageUrls($pool, $policy, $localRepo, $repositories);
$localRepo->write();
}
return array(0, $devPackages);
}
示例12: output
/**
* Print a message in the user console
*
* @param string $level The message level ("normal", "verbose", "very-verbose", "debug")
* @param string $message The message (sprintf format)
* @param array $vars The message variables
*
* @return void
*/
protected function output($level, $message, array $vars = array())
{
if ('normal' === $level || 'verbose' === $level && $this->io->isVerbose() || 'very-verbose' === $level && $this->io->isVeryVerbose() || 'debug' === $level && $this->io->isDebug()) {
$this->io->write(vsprintf($message, $vars));
}
}