当前位置: 首页>>代码示例>>PHP>>正文


PHP IOInterface::enableDebugging方法代码示例

本文整理汇总了PHP中Composer\IO\IOInterface::enableDebugging方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::enableDebugging方法的具体用法?PHP IOInterface::enableDebugging怎么用?PHP IOInterface::enableDebugging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\IO\IOInterface的用法示例。


在下文中一共展示了IOInterface::enableDebugging方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doRun

 /**
  * {@inheritDoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
     if (version_compare(PHP_VERSION, '5.3.2', '<')) {
         $output->writeln('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>');
     }
     if (defined('COMPOSER_DEV_WARNING_TIME') && $this->getCommandName($input) !== 'self-update') {
         if (time() > COMPOSER_DEV_WARNING_TIME) {
             $output->writeln(sprintf('<warning>Warning: This development build of composer is over 30 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
         }
     }
     if (getenv('COMPOSER_NO_INTERACTION')) {
         $input->setInteractive(false);
     }
     if ($input->hasParameterOption('--profile')) {
         $startTime = microtime(true);
         $this->io->enableDebugging($startTime);
     }
     if ($newWorkDir = $this->getNewWorkingDir($input)) {
         $oldWorkingDir = getcwd();
         chdir($newWorkDir);
     }
     $result = parent::doRun($input, $output);
     if (isset($oldWorkingDir)) {
         chdir($oldWorkingDir);
     }
     if (isset($startTime)) {
         $output->writeln('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's');
     }
     return $result;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:34,代码来源:Application.php

示例2: doRun

 /**
  * {@inheritDoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
     ErrorHandler::register($this->io);
     if (PHP_VERSION_ID < 50302) {
         $this->getIO()->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>');
     }
     if (defined('COMPOSER_DEV_WARNING_TIME')) {
         $commandName = '';
         if ($name = $this->getCommandName($input)) {
             try {
                 $commandName = $this->find($name)->getName();
             } catch (\InvalidArgumentException $e) {
             }
         }
         if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
             if (time() > COMPOSER_DEV_WARNING_TIME) {
                 $this->getIO()->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
             }
         }
     }
     if (getenv('COMPOSER_NO_INTERACTION')) {
         $input->setInteractive(false);
     }
     // switch working dir
     if ($newWorkDir = $this->getNewWorkingDir($input)) {
         $oldWorkingDir = getcwd();
         chdir($newWorkDir);
         if ($this->getIO()->isDebug() >= 4) {
             $this->getIO()->writeError('Changed CWD to ' . getcwd());
         }
     }
     // add non-standard scripts as own commands
     $file = Factory::getComposerFile();
     if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
         if (isset($composer['scripts']) && is_array($composer['scripts'])) {
             foreach ($composer['scripts'] as $script => $dummy) {
                 if (!defined('Composer\\Script\\ScriptEvents::' . str_replace('-', '_', strtoupper($script)))) {
                     if ($this->has($script)) {
                         $this->getIO()->writeError('<warning>A script named ' . $script . ' would override a native Composer function and has been skipped</warning>');
                     } else {
                         $this->add(new Command\ScriptAliasCommand($script));
                     }
                 }
             }
         }
     }
     if ($input->hasParameterOption('--profile')) {
         $startTime = microtime(true);
         $this->io->enableDebugging($startTime);
     }
     $result = parent::doRun($input, $output);
     if (isset($oldWorkingDir)) {
         chdir($oldWorkingDir);
     }
     if (isset($startTime)) {
         $this->getIO()->writeError('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's');
     }
     return $result;
 }
开发者ID:aripringle,项目名称:composer,代码行数:63,代码来源:Application.php

示例3: doRun


//.........这里部分代码省略.........
         } catch (\InvalidArgumentException $e) {
         }
     }
     if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
         try {
             foreach ($this->getPluginCommands() as $command) {
                 if ($this->has($command->getName())) {
                     $io->writeError('<warning>Plugin command ' . $command->getName() . ' (' . get_class($command) . ') would override a Composer command and has been skipped</warning>');
                 } else {
                     $this->add($command);
                 }
             }
         } catch (NoSslException $e) {
             // suppress these as they are not relevant at this point
         }
         $this->hasPluginCommands = true;
     }
     // determine command name to be executed incl plugin commands, and check if it's a proxy command
     $isProxyCommand = false;
     if ($name = $this->getCommandName($input)) {
         try {
             $command = $this->find($name);
             $commandName = $command->getName();
             $isProxyCommand = $command instanceof Command\BaseCommand && $command->isProxyCommand();
         } catch (\InvalidArgumentException $e) {
         }
     }
     if (!$isProxyCommand) {
         $io->writeError(sprintf('Running %s (%s) with %s on %s', Composer::VERSION, Composer::RELEASE_DATE, defined('HHVM_VERSION') ? 'HHVM ' . HHVM_VERSION : 'PHP ' . PHP_VERSION, php_uname('s') . ' / ' . php_uname('r')), true, IOInterface::DEBUG);
         if (PHP_VERSION_ID < 50302) {
             $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>');
         }
         if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
             $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
         }
         if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
             $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
         }
         if (getenv('COMPOSER_NO_INTERACTION')) {
             $input->setInteractive(false);
         }
         if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
             if (function_exists('posix_getuid') && posix_getuid() === 0) {
                 if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
                     $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
                 }
                 if ($uid = (int) getenv('SUDO_UID')) {
                     // Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on
                     // ref. https://github.com/composer/composer/issues/5119
                     Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
                 }
             }
             // Silently clobber any remaining sudo leases on the current user as well to avoid privilege escalations
             Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
         }
         // Check system temp folder for usability as it can cause weird runtime issues otherwise
         Silencer::call(function () use($io) {
             $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
             if (!(file_put_contents($tempfile, __FILE__) && file_get_contents($tempfile) == __FILE__ && unlink($tempfile) && !file_exists($tempfile))) {
                 $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
             }
         });
         // add non-standard scripts as own commands
         $file = Factory::getComposerFile();
         if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
             if (isset($composer['scripts']) && is_array($composer['scripts'])) {
                 foreach ($composer['scripts'] as $script => $dummy) {
                     if (!defined('Composer\\Script\\ScriptEvents::' . str_replace('-', '_', strtoupper($script)))) {
                         if ($this->has($script)) {
                             $io->writeError('<warning>A script named ' . $script . ' would override a Composer command and has been skipped</warning>');
                         } else {
                             $this->add(new Command\ScriptAliasCommand($script));
                         }
                     }
                 }
             }
         }
     }
     try {
         if ($input->hasParameterOption('--profile')) {
             $startTime = microtime(true);
             $this->io->enableDebugging($startTime);
         }
         $result = parent::doRun($input, $output);
         if (isset($oldWorkingDir)) {
             chdir($oldWorkingDir);
         }
         if (isset($startTime)) {
             $io->writeError('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's');
         }
         restore_error_handler();
         return $result;
     } catch (ScriptExecutionException $e) {
         return $e->getCode();
     } catch (\Exception $e) {
         $this->hintCommonErrors($e);
         restore_error_handler();
         throw $e;
     }
 }
开发者ID:jhyeon1010,项目名称:composer,代码行数:101,代码来源:Application.php


注:本文中的Composer\IO\IOInterface::enableDebugging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。