本文整理汇总了PHP中Symfony\Component\Console\Command\Command::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::setName方法的具体用法?PHP Command::setName怎么用?PHP Command::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Command\Command
的用法示例。
在下文中一共展示了Command::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setName
/**
* @param string $name
* @return AbstractCommand
*/
public function setName($name)
{
if (!$this->getName()) {
return parent::setName($name);
}
return $this;
}
示例2: add
public function add(Command $command, $namespace = '')
{
if (strlen($namespace)) {
$command->setName($namespace . ':' . $command->getName());
}
$this->app->add($command);
}
示例3: __construct
public function __construct(Command $singleCommand)
{
global $argv;
$this->singleCommand = $singleCommand;
// Use the command's name as the whole app's name
$this->setName($singleCommand->getName());
// Then set the command's name to be the name of the script file
// executed (as executed, regardless of symlinks, etc) - i.e.
// whatever's set as $argv[0] - because this name ends up displayed in
// the "Usage" line of the `--help` output. Though we use the executed
// script's base name (i.e. none of the directories leading to it)
// because including any parts of the directory path results in a
// `--help` output that's very different to all native/standard
// commands.
// This will result in the "Usage" section displaying as:
// my-command.php [options] [--] <arguments>
// instead of showing the name of the command in place of
// 'my-command.php', which is especially useful for single-command
// apps, as the command name is never even referenced anywhere else!
$commandName = isset($argv[0]) ? basename($argv[0]) : 'command.php';
$singleCommand->setName($commandName);
parent::__construct();
$this->add($singleCommand);
$this->setDefaultCommand($singleCommand->getName());
// If the command class has an 'APP_VERSION' constant defined, we use
// that as the entire app's version, as this seems like a much more
// sensible place to indicate the version than in the Application
// constructor which is tucked away in a non-obvious place!
$commandClass = get_class($singleCommand);
if (defined($commandClass . '::APP_VERSION')) {
$this->setVersion(constant($commandClass . '::APP_VERSION'));
}
}
示例4: configureTransfer
public static function configureTransfer(BaseCommand $command, $name = 'transfer', $output = true)
{
$command->setName($name)->setDescription('Clone all nodes and relations from one Neo4j Server database into another.');
DumpCommand::configureSourceConnectionOptions($command);
if ($output) {
DumpCommand::configureOutputOptions($command);
}
ImportCommand::configureTargetConnectionOptions($command);
}
示例5: integrate
public function integrate(Command $cmd)
{
$cmd->setName("metro:" . $cmd->getName());
$definition = $cmd->getDefinition();
$options = $definition->getOptions();
if (isset($options['short'])) {
// remove -s shortcut (already used by Symfony's --shell option)
$shortOption = $options['short'];
$options['short'] = new InputOption('short', null, InputOption::VALUE_NONE, $shortOption->getDescription());
$definition->setOptions($options);
}
}
示例6: configureImport
public static function configureImport(BaseCommand $command, $name = 'import')
{
$command->setName($name)->setDescription('Import all nodes and relations into a Neo4j Server database.');
static::configureTargetConnectionOptions($command);
$command->addOption('input', null, InputArgument::OPTIONAL, 'Cypher input filename. If unspecified, will use STDIN. Set to last:[hostname] to use dump-[hostname]-[yyyyMMdd]-[hhmmss].cypher with the latest timestamp.');
}
示例7: setName
/**
* {@inheritdoc}
*/
public function setName($name)
{
$this->decoratedCommand->setName($name);
return $this;
}
示例8: configure
/**
* configure.
*
* @param Command $command
*/
public static function configure(Command $command)
{
$command->setName('migrations:list')->setDescription('Prints version IDs for all available migrations ordered incrementally.')->addOption('newest-first', null, InputOption::VALUE_NONE, 'Sort list in reverse order (newest first)');
}
示例9: configureDump
public static function configureDump(BaseCommand $command, $name = 'dump')
{
$command->setName($name)->setDescription('Dump all nodes and relations from a Neo4j Server database.');
static::configureSourceConnectionOptions($command);
static::configureOutputOptions($command);
}
示例10: configure
public function configure(Command $command)
{
$command->setName('task:purge-badge-page-props')->setDescription('Purge page props of pages to update badges')->addOption('chunk', null, InputOption::VALUE_OPTIONAL, 'The chunk size to fetch entities', 100);
}
示例11: configure
protected function configure()
{
parent::setName('generate:entity')->setDescription('Generates a Link entity from a table')->addArgument('entity', InputArgument::REQUIRED, 'The fully-qualified class name of the entity to ' . 'generate (use forward slashes instead of backslashes)')->addArgument('destination', InputArgument::OPTIONAL, 'The directory where the generated entity ' . 'should be saved', self::DEFAULT_PATH)->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite any existing files');
}
示例12: setName
public function setName($name)
{
parent::setName($name);
return $this->innerCommand->setName($name);
}
示例13: configure
/**
* Configures a console command by setting name, description, arguments, etc.
*
* @param Command $command
*/
public static function configure(Command $command)
{
$command->setName('config:status');
$command->setAliases(['status']);
$command->setDescription('Shows the current migration status.');
}
示例14: configure
/**
* @inheritdoc
*/
public static function configure(Command $command)
{
$command->setName('storage:latest')->setDescription('Outputs the ID of the latest migrated version.');
}
示例15: configure
public function configure(Command $command)
{
$command->setName('task:update-badges')->setDescription('Update badges based on Wikipedia categories on Wikidata')->addOption('badge', null, InputOption::VALUE_REQUIRED, 'The badge to set')->addOption('category', null, InputOption::VALUE_REQUIRED, 'The category to query')->addOption('bot', null, InputOption::VALUE_OPTIONAL, 'Mark edits as bot', true)->addOption('summary', null, InputOption::VALUE_OPTIONAL, 'Override the default edit summary', 'Bot: Adding badge [[$badgeId]] for site $wiki based on Category:$category');
}