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


PHP Console::stderr方法代码示例

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


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

示例1: StartCurator

/**
 * Preps the application for running, then runs it. If this function is called more than once, an E_USER_ERROR is triggered.
 * 
 * @param string $root_dir The path to the root of the installation.
 * @return void
 */
function StartCurator()
{
    static $did_start = false;
    // set up the exit status.
    $exit_status = 0;
    // make sure this is only run once.
    if ($did_start === false) {
        $autoload = Autoload::singleton();
        // configure the autoloader.
        try {
            $autoload->setBaseDir(CURATOR_APP_DIR);
            $autoload->register();
        } catch (\Exception $e) {
            Console::stderr('** Could not register the autoloader:');
            Console::stderr('   ' . $e->getMessage());
            die;
        }
        // once the autoloader is in place, we are started up.
        $did_start = true;
        try {
            $app = new Application();
            $exit_status = $app->run();
        } catch (\Exception $e) {
            Console::stderr('** Could not run the application:');
            Console::stderr('   ' . $e->getMessage());
            die;
        }
    } else {
        // if we are called again, bail.
        trigger_error('StartCurator called after already being called.', E_USER_ERROR);
    }
    // send the status back.
    return $exit_status;
}
开发者ID:hscale,项目名称:curator,代码行数:40,代码来源:Bootstrap.php

示例2: run

 /**
  * Runs the application, returning the status to exit with.
  * 
  * @return integer The exit status.
  * @access public
  */
 public function run()
 {
     $exit_status = 0;
     // Curator doesn't do anything without at least one argument, besides the curator command itself.
     if ($this->argc === 0) {
         Console::stdout('Use \'' . $this->cmd . ' --help\' for usage information.');
     } else {
         try {
             $parser = $this->buildCommandLineParser();
             $result = $parser->parse();
             // determine where our relevant directories are.
             if (!empty($result->options['proj_path'])) {
                 $project_dir = realpath($result->options['proj_path']);
             }
             if (empty($project_dir)) {
                 $project_dir = $_SERVER['PWD'];
             }
             $this->createDirectoryAtPath($project_dir);
             try {
                 $project = new Project($project_dir);
                 switch ($result->command_name) {
                     case 'new':
                         $project->install();
                         break;
                     case 'clean':
                         $project->clean();
                         break;
                     case 'build':
                         $project->build();
                         break;
                 }
             } catch (\Exception $e) {
                 Console::stderr('** Command \'' . $result->command_name . '\' has failed:');
                 Console::stderr('  ' . $e->getMessage());
             }
         } catch (\Exception $e) {
             $parser->displayError($e->getMessage());
             $exit_status = $e->getCode();
         }
     }
     return $exit_status;
 }
开发者ID:hscale,项目名称:curator,代码行数:48,代码来源:Application.php


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