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


PHP OutputInterface::error方法代码示例

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


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

示例1: lock

 /**
  * Attempt to lock this command.
  *
  * @param OutputInterface $output The output object to use for any error messages
  *
  * @return void
  */
 public function lock(OutputInterface $output)
 {
     # If this command doesn't require locking then don't do anything
     if (!$this->lock) {
         return;
     }
     $path = $this->getLockPath();
     # If the lock file doesn't already exist then we are creating it, so we need to open the permissions on it
     $newFile = !file_exists($path);
     # Attempt to create/open a lock file for this command
     if (!($this->lock = fopen($path, "w"))) {
         $output->error("Unable to create a lock file (" . $path . ")");
         exit(Application::STATUS_PERMISSIONS);
     }
     # Attempt to lock the file we've just opened
     if (!flock($this->lock, LOCK_EX | LOCK_NB)) {
         fclose($this->lock);
         $output->error("Another instance of this command (" . $this->getName() . ") is currently running");
         exit(Application::STATUS_LOCKED);
     }
     # Ensure the permissions are as open as possible to allow multiple users to run the same command
     if ($newFile) {
         chmod($path, 0777);
     }
 }
开发者ID:lightglitch,项目名称:console,代码行数:32,代码来源:Command.php

示例2: writeError

 /**
  * {@inheritdoc}
  */
 protected function writeError(OutputInterface $output, \Exception $error)
 {
     if ($output instanceof SymfonyStyle) {
         $output->newLine();
         $output->error($error->getMessage());
         return;
     }
     parent::writeError($output, $error);
 }
开发者ID:xingshanghe,项目名称:symfony,代码行数:12,代码来源:SymfonyQuestionHelper.php

示例3: loadConfig

 protected function loadConfig(OutputInterface $output)
 {
     try {
         $this->config = new Config(getcwd() . '/spacewave.yml');
     } catch (FileNotFoundException $e) {
         $output->error('Could not find spacewave.yml in directory');
         exit;
     }
 }
开发者ID:redfrogevents,项目名称:spacewave,代码行数:9,代码来源:DeployCommand.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // Database options
     $dbType = $input->getOption('db-type');
     $dbFile = $input->getOption('db-file');
     $dbHost = $input->getOption('db-host');
     $dbName = $input->getOption('db-name');
     $dbUser = $input->getOption('db-user');
     $dbPass = $input->getOption('db-pass');
     $dbPrefix = $input->getOption('db-prefix');
     $dbPort = $input->getOption('db-port');
     $databases = $this->site->getDatabaseTypes();
     if ($dbType === 'sqlite') {
         $database = array('database' => $dbFile, 'prefix' => $dbPrefix, 'namespace' => $databases[$dbType]['namespace'], 'driver' => $dbType);
     } else {
         $database = array('database' => $dbName, 'username' => $dbUser, 'password' => $dbPass, 'prefix' => $dbPrefix, 'port' => $dbPort, 'host' => $dbHost, 'namespace' => $databases[$dbType]['namespace'], 'driver' => $dbType);
     }
     $this->backupSitesFile($io);
     try {
         $this->runInstaller($io, $input, $database);
     } catch (Exception $e) {
         $output->error($e->getMessage());
         return;
     }
     $this->restoreSitesFile($io);
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:30,代码来源:InstallCommand.php


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