本文整理汇总了PHP中Cake\Console\ConsoleOptionParser::options方法的典型用法代码示例。如果您正苦于以下问题:PHP ConsoleOptionParser::options方法的具体用法?PHP ConsoleOptionParser::options怎么用?PHP ConsoleOptionParser::options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Console\ConsoleOptionParser
的用法示例。
在下文中一共展示了ConsoleOptionParser::options方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}