ConsoleExamplePrivateCommand.php

Same filename and directory in other branches
  1. main core/modules/system/tests/modules/console_test/src/Command/ConsoleExamplePrivateCommand.php

Namespace

Drupal\console_test\Command

File

core/modules/system/tests/modules/console_test/src/Command/ConsoleExamplePrivateCommand.php

View source
<?php

declare (strict_types=1);
namespace Drupal\console_test\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
 * An example private command.
 *
 * A command is considered private when it does not have an attribute or name
 * via configure().
 *
 * @internal
 */
class ConsoleExamplePrivateCommand extends Command {
  
  /**
   * {@inheritdoc}
   */
  public function getName() : ?string {
    return 'example:command-private';
  }
  
  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) : int {
    $io = new SymfonyStyle($input, $output);
    $io->success('Done with private command.');
    return Command::SUCCESS;
  }

}

Classes

Title Deprecated Summary
ConsoleExamplePrivateCommand An example private command.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.