本文整理汇总了PHP中Composer\IO\IOInterface::isDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::isDebug方法的具体用法?PHP IOInterface::isDebug怎么用?PHP IOInterface::isDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\IO\IOInterface
的用法示例。
在下文中一共展示了IOInterface::isDebug方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createConfig
public static function createConfig(IOInterface $io = null, $cwd = null)
{
$cwd = $cwd ?: getcwd();
$home = self::getHomeDir();
$cacheDir = self::getCacheDir($home);
foreach (array($home, $cacheDir) as $dir) {
if (!file_exists($dir . '/.htaccess')) {
if (!is_dir($dir)) {
@mkdir($dir, 0777, true);
}
@file_put_contents($dir . '/.htaccess', 'Deny from all');
}
}
$config = new Config(true, $cwd);
$config->merge(array('config' => array('home' => $home, 'cache-dir' => $cacheDir)));
$file = new JsonFile($config->get('home') . '/config.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge($file->read());
}
$config->setConfigSource(new JsonConfigSource($file));
$file = new JsonFile($config->get('home') . '/auth.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge(array('config' => $file->read()));
}
$config->setAuthConfigSource(new JsonConfigSource($file, true));
return $config;
}
示例2: doDeploy
public function doDeploy()
{
$this->sortPackages();
/** @var Entry $package */
foreach ($this->packages as $package) {
if ($this->io->isDebug()) {
$this->io->write('start magento deploy for ' . $package->getPackageName());
}
$package->getDeployStrategy()->deploy();
}
}
示例3: writeDebug
/**
* print Debug Message
*
* @param $message
*/
private function writeDebug($message, $varDump = null)
{
if ($this->io->isDebug()) {
$this->io->write($message);
if (!is_null($varDump)) {
var_dump($varDump);
}
}
}
示例4: deployLibraries
protected function deployLibraries()
{
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();
$autoloadDirectories = array();
$libraryPath = $this->config->getLibraryPath();
if ($libraryPath === null) {
if ($this->io->isDebug()) {
$this->io->write('jump over deployLibraries as no Magento libraryPath is set');
}
return;
}
$vendorDir = rtrim($this->composer->getConfig()->get('vendor-dir'), '/');
$filesystem = $this->filesystem;
$filesystem->removeDirectory($libraryPath);
$filesystem->ensureDirectoryExists($libraryPath);
foreach ($packages as $package) {
/** @var PackageInterface $package */
$packageConfig = $this->config->getLibraryConfigByPackagename($package->getName());
if ($packageConfig === null) {
continue;
}
if (!isset($packageConfig['autoload'])) {
$packageConfig['autoload'] = array('/');
}
foreach ($packageConfig['autoload'] as $path) {
$autoloadDirectories[] = $libraryPath . '/' . $package->getName() . "/" . $path;
}
if ($this->io->isDebug()) {
$this->io->write('Magento deployLibraries executed for ' . $package->getName());
}
$libraryTargetPath = $libraryPath . '/' . $package->getName();
$filesystem->removeDirectory($libraryTargetPath);
$filesystem->ensureDirectoryExists($libraryTargetPath);
$this->copyRecursive($vendorDir . '/' . $package->getPrettyName(), $libraryTargetPath);
}
$autoloadGenerator = new AutoloadGenerator(new EventDispatcher($this->composer, $this->io));
$classmap = ClassMapGenerator::createMap($libraryPath);
$executable = $this->composer->getConfig()->get('bin-dir') . '/phpab';
if (!file_exists($executable)) {
$executable = $this->composer->getConfig()->get('vendor-dir') . '/theseer/autoload/composer/bin/phpab';
}
if (file_exists($executable)) {
if ($this->io->isDebug()) {
$this->io->write('Magento deployLibraries executes autoload generator');
}
$process = new Process($executable . " -o {$libraryPath}/autoload.php " . implode(' ', $autoloadDirectories));
$process->run();
} else {
if ($this->io->isDebug()) {
$this->io->write('Magento deployLibraries autoload generator not availabel, you should require "theseer/autoload"');
var_dump($executable, getcwd());
}
}
}
示例5: createGitHooks
/**
* Symlink each known Git hook to the PHP Composter bootstrapping script.
*
* @since 0.1.0
*
* @param Filesystem $filesystem Reference to the Filesystem instance.
*/
protected function createGitHooks(Filesystem $filesystem)
{
$hooksPath = Paths::getPath('root_hooks');
$gitScriptPath = Paths::getPath('git_script');
foreach ($this->getGitHookNames() as $githook) {
$hookPath = $hooksPath . $githook;
if (static::$io->isDebug()) {
static::$io->write(sprintf(_('Symlinking %1$s to %2$s'), $hookPath, $gitScriptPath));
}
$filesystem->relativeSymlink($gitScriptPath, $hookPath);
}
}
示例6: 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));
}
}
}
示例7: 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;
}
示例8: createConfig
/**
* @param IOInterface|null $io
* @return Config
*/
public static function createConfig(IOInterface $io = null, $cwd = null)
{
$cwd = $cwd ?: getcwd();
$config = new Config(true, $cwd);
// determine and add main dirs to the config
$home = self::getHomeDir();
$config->merge(array('config' => array('home' => $home, 'cache-dir' => self::getCacheDir($home), 'data-dir' => self::getDataDir($home))));
// Protect directory against web access. Since HOME could be
// the www-data's user home and be web-accessible it is a
// potential security risk
$dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
foreach ($dirs as $dir) {
if (!file_exists($dir . '/.htaccess')) {
if (!is_dir($dir)) {
Silencer::call('mkdir', $dir, 0777, true);
}
Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
}
}
// load global config
$file = new JsonFile($config->get('home') . '/config.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge($file->read());
}
$config->setConfigSource(new JsonConfigSource($file));
// load global auth file
$file = new JsonFile($config->get('home') . '/auth.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge(array('config' => $file->read()));
}
$config->setAuthConfigSource(new JsonConfigSource($file, true));
// load COMPOSER_AUTH environment variable if set
if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
$authData = json_decode($composerAuthEnv, true);
if (is_null($authData)) {
throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
}
if ($io && $io->isDebug()) {
$io->writeError('Loading auth config from COMPOSER_AUTH');
}
$config->merge(array('config' => $authData));
}
return $config;
}
示例9: createConfig
/**
* @param IOInterface|null $io
* @return Config
*/
public static function createConfig(IOInterface $io = null, $cwd = null)
{
$cwd = $cwd ?: getcwd();
// determine home and cache dirs
$home = self::getHomeDir();
$cacheDir = self::getCacheDir($home);
$dataDir = self::getDataDir($home);
// Protect directory against web access. Since HOME could be
// the www-data's user home and be web-accessible it is a
// potential security risk
foreach (array($home, $cacheDir, $dataDir) as $dir) {
if (!file_exists($dir . '/.htaccess')) {
if (!is_dir($dir)) {
@mkdir($dir, 0777, true);
}
@file_put_contents($dir . '/.htaccess', 'Deny from all');
}
}
$config = new Config(true, $cwd);
// add dirs to the config
$config->merge(array('config' => array('home' => $home, 'cache-dir' => $cacheDir, 'data-dir' => $dataDir)));
// load global config
$file = new JsonFile($config->get('home') . '/config.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge($file->read());
}
$config->setConfigSource(new JsonConfigSource($file));
// load global auth file
$file = new JsonFile($config->get('home') . '/auth.json');
if ($file->exists()) {
if ($io && $io->isDebug()) {
$io->writeError('Loading config file ' . $file->getPath());
}
$config->merge(array('config' => $file->read()));
}
$config->setAuthConfigSource(new JsonConfigSource($file, true));
return $config;
}
示例10: 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);
}
示例11: 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));
}
}
示例12: update
/**
* {@inheritDoc}
*/
public function update(PackageInterface $initial, PackageInterface $target, $path)
{
if (!$target->getSourceReference()) {
throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
}
$name = $target->getName();
if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
if ($target->getSourceType() === 'svn') {
$from = $initial->getSourceReference();
$to = $target->getSourceReference();
} else {
$from = substr($initial->getSourceReference(), 0, 7);
$to = substr($target->getSourceReference(), 0, 7);
}
$name .= ' ' . $initial->getPrettyVersion();
} else {
$from = $initial->getFullPrettyVersion();
$to = $target->getFullPrettyVersion();
}
$this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
$this->cleanChanges($initial, $path, true);
$urls = $target->getSourceUrls();
$exception = null;
while ($url = array_shift($urls)) {
try {
if (Filesystem::isLocalPath($url)) {
$url = realpath($url);
}
$this->doUpdate($initial, $target, $path, $url);
$exception = null;
break;
} catch (\Exception $exception) {
// rethrow phpunit exceptions to avoid hard to debug bug failures
if ($exception instanceof \PHPUnit_Framework_Exception) {
throw $exception;
}
if ($this->io->isDebug()) {
$this->io->writeError('Failed: [' . get_class($exception) . '] ' . $exception->getMessage());
} elseif (count($urls)) {
$this->io->writeError(' Failed, trying the next URL');
}
}
}
$this->reapplyChanges($path);
// print the commit logs if in verbose mode and VCS metadata is present
// because in case of missing metadata code would trigger another exception
if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
$message = 'Pulling in changes:';
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
if (!trim($logs)) {
$message = 'Rolling back changes:';
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
}
if (trim($logs)) {
$logs = implode("\n", array_map(function ($line) {
return ' ' . $line;
}, explode("\n", $logs)));
// escape angle brackets for proper output in the console
$logs = str_replace('<', '\\<', $logs);
$this->io->writeError(' ' . $message);
$this->io->writeError($logs);
}
}
if (!$urls && $exception) {
throw $exception;
}
$this->io->writeError('');
}
示例13: info
protected function info()
{
if ($this->io->isDebug()) {
call_user_func_array([$this, 'write'], func_get_args());
}
}
示例14: update
/**
* {@inheritDoc}
*/
public function update(PackageInterface $initial, PackageInterface $target, $path)
{
if (!$target->getSourceReference()) {
throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
}
$name = $target->getName();
if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
if ($target->getSourceType() === 'svn') {
$from = $initial->getSourceReference();
$to = $target->getSourceReference();
} else {
$from = substr($initial->getSourceReference(), 0, 7);
$to = substr($target->getSourceReference(), 0, 7);
}
$name .= ' ' . $initial->getPrettyVersion();
} else {
$from = $initial->getFullPrettyVersion();
$to = $target->getFullPrettyVersion();
}
$this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
$this->cleanChanges($initial, $path, true);
$urls = $target->getSourceUrls();
while ($url = array_shift($urls)) {
try {
if (Filesystem::isLocalPath($url)) {
$url = realpath($url);
}
$this->doUpdate($initial, $target, $path, $url);
break;
} catch (\Exception $e) {
if ($this->io->isDebug()) {
$this->io->writeError('Failed: [' . get_class($e) . '] ' . $e->getMessage());
} elseif (count($urls)) {
$this->io->writeError(' Failed, trying the next URL');
} else {
// in case of failed update, try to reapply the changes before aborting
$this->reapplyChanges($path);
throw $e;
}
}
}
$this->reapplyChanges($path);
// print the commit logs if in verbose mode
if ($this->io->isVerbose()) {
$message = 'Pulling in changes:';
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
if (!trim($logs)) {
$message = 'Rolling back changes:';
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
}
if (trim($logs)) {
$logs = implode("\n", array_map(function ($line) {
return ' ' . $line;
}, explode("\n", $logs)));
// escape angle brackets for proper output in the console
$logs = str_replace('<', '\\<', $logs);
$this->io->writeError(' ' . $message);
$this->io->writeError($logs);
}
}
$this->io->writeError('');
}