annotate core/lib/Drupal/Core/Command/GenerateProxyClassApplication.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Command;
Chris@0 4
Chris@0 5 use Drupal\Component\ProxyBuilder\ProxyBuilder;
Chris@0 6 use Symfony\Component\Console\Application;
Chris@0 7 use Symfony\Component\Console\Input\InputInterface;
Chris@0 8
Chris@0 9 /**
Chris@0 10 * Provides a console command to generate proxy classes.
Chris@0 11 */
Chris@0 12 class GenerateProxyClassApplication extends Application {
Chris@0 13
Chris@0 14 /**
Chris@0 15 * The proxy builder.
Chris@0 16 *
Chris@0 17 * @var \Drupal\Component\ProxyBuilder\ProxyBuilder
Chris@0 18 */
Chris@0 19 protected $proxyBuilder;
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Constructs a new GenerateProxyClassApplication instance.
Chris@0 23 *
Chris@0 24 * @param \Drupal\Component\ProxyBuilder\ProxyBuilder $proxy_builder
Chris@0 25 * The proxy builder.
Chris@0 26 */
Chris@0 27 public function __construct(ProxyBuilder $proxy_builder) {
Chris@0 28 $this->proxyBuilder = $proxy_builder;
Chris@0 29
Chris@0 30 parent::__construct();
Chris@0 31 }
Chris@0 32
Chris@0 33 /**
Chris@0 34 * {@inheritdoc}
Chris@0 35 */
Chris@0 36 protected function getCommandName(InputInterface $input) {
Chris@0 37 return 'generate-proxy-class';
Chris@0 38 }
Chris@0 39
Chris@0 40 /**
Chris@0 41 * {@inheritdoc}
Chris@0 42 */
Chris@0 43 protected function getDefaultCommands() {
Chris@0 44 // Even though this is a single command, keep the HelpCommand (--help).
Chris@0 45 $default_commands = parent::getDefaultCommands();
Chris@0 46 $default_commands[] = new GenerateProxyClassCommand($this->proxyBuilder);
Chris@0 47 return $default_commands;
Chris@0 48 }
Chris@0 49
Chris@0 50 /**
Chris@0 51 * {@inheritdoc}
Chris@0 52 *
Chris@0 53 * Overridden so the application doesn't expect the command name as the first
Chris@0 54 * argument.
Chris@0 55 */
Chris@0 56 public function getDefinition() {
Chris@0 57 $definition = parent::getDefinition();
Chris@0 58 // Clears the normal first argument (the command name).
Chris@0 59 $definition->setArguments();
Chris@0 60 return $definition;
Chris@0 61 }
Chris@0 62
Chris@0 63 }