comparison core/lib/Drupal/Core/Command/GenerateProxyClassApplication.php @ 0:4c8ae668cc8c

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