本文整理汇总了PHP中Composer\IO\IOInterface::isVerbose方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::isVerbose方法的具体用法?PHP IOInterface::isVerbose怎么用?PHP IOInterface::isVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\IO\IOInterface
的用法示例。
在下文中一共展示了IOInterface::isVerbose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: info
/**
* Log an informative message
*
* Messages will be output at the "verbose" logging level (eg `-v` needed
* on the Composer command).
*
* @param string $message
*/
public function info($message)
{
if ($this->inputOutput->isVerbose()) {
$message = " <info>[{$this->name}]</info> {$message}";
$this->log($message);
}
}
示例2: execute
/**
* The 'logical'-operation of this Installer.
* PHPCS does not define constants for the config options,
* doing so ourself would only lead to outdated intel.
*
* @see https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options
*/
public function execute()
{
if ($this->io->isVerbose()) {
$this->io->write('Configured phpcs to use Hostnet standard');
}
self::configure();
}
示例3: activate
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
$this->curlClient = new CurlClient(self::generateUserAgent());
if ($this->io->isVerbose()) {
$this->io->write("<info>[Curl]</info> plugin activate");
}
$pluginConfig = $this->composer->getConfig()->get('curl-plugin');
if (isset($pluginConfig['hosts']) && is_array($pluginConfig['hosts'])) {
$this->hosts = array_merge($this->hosts, $pluginConfig['hosts']);
}
}
示例4: debug
/**
* Log a debug message
*
* Messages will be output at the "verbose" logging level (eg `-v` needed
* on the Composer command).
*
* @param string $message
*/
public function debug($message)
{
if ($this->inputOutput->isVerbose()) {
$message = " <info>[{$this->name}]</info> {$message}";
if (method_exists($this->inputOutput, 'writeError')) {
$this->inputOutput->writeError($message);
} else {
// @codeCoverageIgnoreStart
// Backwards compatiblity for Composer before cb336a5
$this->inputOutput->write($message);
// @codeCoverageIgnoreEnd
}
}
}
示例5: executeCommand
/**
* Executes a shell command with escaping.
*
* @param string $cmd
* @return bool
*/
protected function executeCommand($cmd)
{
// Shell-escape all arguments except the command.
$args = func_get_args();
foreach ($args as $index => $arg) {
if ($index !== 0) {
$args[$index] = escapeshellarg($arg);
}
}
// And replace the arguments.
$command = call_user_func_array('sprintf', $args);
$output = '';
if ($this->io->isVerbose()) {
$this->io->write('<comment>' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $data) use($io) {
if ($type == Process::ERR) {
$io->write('<error>' . $data . '</error>');
} else {
$io->write('<comment>' . $data . '</comment>');
}
};
}
return $this->executor->execute($command, $output) == 0;
}
示例6: 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>');
}
}
}
示例7: __construct
public function __construct(array $repoConfig, IOInterface $io, Config $config = null, array $drivers = null)
{
$this->drivers = $drivers ?: array('github' => 'Composer\\Repository\\Vcs\\GitHubDriver', 'git-bitbucket' => 'Composer\\Repository\\Vcs\\GitBitbucketDriver', 'git' => 'Composer\\Repository\\Vcs\\GitDriver', 'svn' => 'Composer\\Repository\\Vcs\\SvnDriver', 'hg-bitbucket' => 'Composer\\Repository\\Vcs\\HgBitbucketDriver', 'hg' => 'Composer\\Repository\\Vcs\\HgDriver');
$this->url = $repoConfig['url'];
$this->io = $io;
$this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
$this->verbose = $io->isVerbose();
}
示例8: printWarning
/**
* @param $message
* @param Exception|null $exception
*/
private function printWarning($message, Exception $exception = null)
{
if (!$exception) {
$reasonPhrase = '';
} elseif ($this->io->isVerbose()) {
$reasonPhrase = $exception instanceof PuliRunnerException ? $exception->getFullError() : $exception->getMessage() . "\n\n" . $exception->getTraceAsString();
} else {
$reasonPhrase = $exception instanceof PuliRunnerException ? $exception->getShortError() : $exception->getMessage();
}
$this->io->writeError(sprintf('<warning>Warning: %s%s</warning>', $message, $reasonPhrase ? ': ' . $reasonPhrase : '.'));
}
示例9: activate
/**
* Activate the Composer plugin.
*
* @since 0.1.0
*
* @param Composer $composer Reference to the Composer instance.
* @param IOInterface $io Reference to the IO interface.
*/
public function activate(Composer $composer, IOInterface $io)
{
static::$io = $io;
if (static::$io->isVerbose()) {
static::$io->write(_('Activating PHP Composter plugin'), true);
}
$installer = new Installer(static::$io, $composer);
$composer->getInstallationManager()->addInstaller($installer);
$filesystem = new Filesystem();
$this->cleanUp($filesystem);
$this->linkBootstrapFiles($filesystem);
$this->createGitHooks($filesystem);
}
示例10: executeCommand
/**
* Executes a shell command
*
* @param string $command the command to execute
* @param mixed $output the output will be written into this var if passed by ref
* if a callable is passed it will be used as output handler
* @param string $cwd the working directory
* @return bool
*/
protected function executeCommand($command, &$output = null, $cwd = null)
{
$success = $this->executor->execute($command, $output, $cwd) == 0;
if ($this->io->isVerbose()) {
$this->io->write('<comment>' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $data) use($io) {
if ($type == Process::ERR) {
$io->write('<error>' . $data . '</error>');
} else {
$io->write('<comment>' . $data . '</comment>');
}
};
}
return $success;
}
示例11: createRunonce
/**
* Create the global runonce file TL_ROOT/system/runonce.php file if required.
*
* @param IOInterface $inputOutput The composer io stream.
*
* @param string $root The Contao installation root path.
*
* @return void
*/
public static function createRunonce(IOInterface $inputOutput, $root)
{
// create runonce
$runonces = array_unique(static::$runonces);
if (count($runonces)) {
$file = 'system/runonce.php';
$buffer = '';
$index = 0;
while (file_exists($root . DIRECTORY_SEPARATOR . $file)) {
$buffer .= file_get_contents($root . DIRECTORY_SEPARATOR . $file);
$index++;
$file = 'system/runonce_' . $index . '.php';
}
if ($index > 0) {
rename($root . '/system/runonce.php', $root . DIRECTORY_SEPARATOR . $file);
array_unshift($runonces, $file);
}
// Filter the runonces.
$filtered = array();
foreach ($runonces as $runonce) {
if (strpos($buffer, $runonce) !== false) {
$inputOutput->write(sprintf('<info>Not adding runonce %s, already mentioned in existing runonce file.</info>', $runonce));
continue;
}
$filtered[] = $runonce;
}
$array = var_export($filtered, true);
$runonce = <<<EOF
<?php
\$executor = new \\ContaoCommunityAlliance\\Composer\\Plugin\\RunonceExecutor();
\$executor->run({$array});
EOF;
file_put_contents($root . '/system/runonce.php', $runonce);
static::$runonces = array();
$inputOutput->write(sprintf('<info>Runonce created with %d updates</info>', count($runonces)));
if ($inputOutput->isVerbose()) {
foreach ($runonces as $runonce) {
$inputOutput->write(' - ' . $runonce);
}
}
}
}
示例12: findPackages
/**
* Returns ordered list of packages:
* - listed earlier in the composer.json will get earlier in the list
* - childs before parents.
* @return \Composer\Package\PackageInterface[]
*/
public function findPackages()
{
$root = $this->composer->getPackage();
$this->plainList[$root->getPrettyName()] = $root;
foreach ($this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages() as $package) {
$this->plainList[$package->getPrettyName()] = $package;
}
$this->orderedList = [];
$this->iteratePackage($root, true);
if ($this->io->isVerbose()) {
$packages = implode("\n", $this->orderedList);
$this->io->writeError($packages);
}
$res = [];
foreach ($this->orderedList as $name) {
$res[] = $this->plainList[$name];
}
return $res;
}
示例13: copyFrom
/**
* Copy from specified file/folder
*
* @param string $webroot Webroot
* @param string $path Path
* @param string $destination Destination (optional)
*
* @return $this
*/
private function copyFrom($webroot, $path, $destination = null)
{
if (null === $destination) {
$destination = $path;
$from = $this->projectRoot . DIRECTORY_SEPARATOR . $path;
} else {
// if the destination was defined then we assume the path is either absolute or relative to the webroot
// because it has been defined by the user in the extra mapping
$from = $path;
}
$to = $this->projectRoot . DIRECTORY_SEPARATOR . $webroot . DIRECTORY_SEPARATOR . $destination;
$filesystem = $this->getFilesystem();
if ($filesystem->exists($to)) {
$filesystem->remove($to);
}
$filesystem->symlink($from, $to, true);
if ($this->io->isVerbose()) {
$this->io->write(sprintf('Moved %s to %s', $from, $to));
}
}
示例14: 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);
}
示例15: putEnvironment
/**
* Put the environment
*/
private function putEnvironment()
{
$parameters = $this->loadYaml($this->file);
foreach ($parameters['parameters'] as $parameterName => $parameterValue) {
$encodedEnv = $this->encodeEnvironment($parameterName, $parameterValue, false);
if (!$this->overwrite && getenv($encodedEnv)) {
if ($this->io->isDebug()) {
$this->io->write(sprintf('<info>Skipped existing environment variable "%s" with value "%s" (exiting value: "%s").</info>', $encodedEnv, $parameterValue, getenv($encodedEnv)));
} elseif ($this->io->isVerbose()) {
$this->io->write(sprintf('<info>Skipped existing environment variable "%s".</info>', $encodedEnv));
}
continue;
}
putenv($this->encodeEnvironment($parameterName, $parameterValue, true));
if ($this->io->isDebug()) {
$this->io->write(sprintf('<info>Set environment variable "%s" to "%s".</info>', $encodedEnv, $parameterValue));
} elseif ($this->io->isVerbose()) {
$this->io->write(sprintf('<info>Set environment variable "%s".</info>', $encodedEnv));
}
}
}