當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConsoleOptionParser::command方法代碼示例

本文整理匯總了PHP中Cake\Console\ConsoleOptionParser::command方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConsoleOptionParser::command方法的具體用法?PHP ConsoleOptionParser::command怎麽用?PHP ConsoleOptionParser::command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Console\ConsoleOptionParser的用法示例。


在下文中一共展示了ConsoleOptionParser::command方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _generateUsage

 /**
  * Generate the usage for a shell based on its arguments and options.
  * Usage strings favor short options over the long ones. and optional args will
  * be indicated with []
  *
  * @return string
  */
 protected function _generateUsage()
 {
     $usage = ['cake ' . $this->_parser->command()];
     $subcommands = $this->_parser->subcommands();
     if (!empty($subcommands)) {
         $usage[] = '[subcommand]';
     }
     $options = [];
     foreach ($this->_parser->options() as $option) {
         $options[] = $option->usage();
     }
     if (count($options) > $this->_maxOptions) {
         $options = ['[options]'];
     }
     $usage = array_merge($usage, $options);
     $args = [];
     foreach ($this->_parser->arguments() as $argument) {
         $args[] = $argument->usage();
     }
     if (count($args) > $this->_maxArgs) {
         $args = ['[arguments]'];
     }
     $usage = array_merge($usage, $args);
     return implode(' ', $usage);
 }
開發者ID:rlugojr,項目名稱:cakephp,代碼行數:32,代碼來源:HelpFormatter.php

示例2: testCommandInflection

 /**
  * test that command() inflects the command name.
  *
  * @return void
  */
 public function testCommandInflection()
 {
     $parser = new ConsoleOptionParser('CommandLine');
     $this->assertEquals('command_line', $parser->command());
 }
開發者ID:JesseDarellMoore,項目名稱:CS499,代碼行數:10,代碼來源:ConsoleOptionParserTest.php


注:本文中的Cake\Console\ConsoleOptionParser::command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。