You are here

class GenerateProxyClassApplication in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Command/GenerateProxyClassApplication.php \Drupal\Core\Command\GenerateProxyClassApplication

Provides a console command to generate proxy classes.

Hierarchy

Expanded class hierarchy of GenerateProxyClassApplication

1 file declares its use of GenerateProxyClassApplication
generate-proxy-class.php in core/scripts/generate-proxy-class.php
A command line application to generate proxy classes.

File

core/lib/Drupal/Core/Command/GenerateProxyClassApplication.php, line 12

Namespace

Drupal\Core\Command
View source
class GenerateProxyClassApplication extends Application {

  /**
   * The proxy builder.
   *
   * @var \Drupal\Component\ProxyBuilder\ProxyBuilder
   */
  protected $proxyBuilder;

  /**
   * Constructs a new GenerateProxyClassApplication instance.
   *
   * @param \Drupal\Component\ProxyBuilder\ProxyBuilder $proxy_builder
   *   The proxy builder.
   */
  public function __construct(ProxyBuilder $proxy_builder) {
    $this->proxyBuilder = $proxy_builder;
    parent::__construct();
  }

  /**
   * {@inheritdoc}
   */
  protected function getCommandName(InputInterface $input) {
    return 'generate-proxy-class';
  }

  /**
   * {@inheritdoc}
   */
  protected function getDefaultCommands() {

    // Even though this is a single command, keep the HelpCommand (--help).
    $default_commands = parent::getDefaultCommands();
    $default_commands[] = new GenerateProxyClassCommand($this->proxyBuilder);
    return $default_commands;
  }

  /**
   * {@inheritdoc}
   *
   * Overridden so the application doesn't expect the command name as the first
   * argument.
   */
  public function getDefinition() {
    $definition = parent::getDefinition();

    // Clears the normal first argument (the command name).
    $definition
      ->setArguments();
    return $definition;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GenerateProxyClassApplication::$proxyBuilder protected property The proxy builder.
GenerateProxyClassApplication::getCommandName protected function Gets the name of the command based on input.
GenerateProxyClassApplication::getDefaultCommands protected function Gets the default commands that should always be available.
GenerateProxyClassApplication::getDefinition public function Overridden so the application doesn't expect the command name as the first argument.
GenerateProxyClassApplication::__construct public function Constructs a new GenerateProxyClassApplication instance.