e4f4d82cd1e8bfff28db1c089fe55bca96115ae1
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Other / ApacheVirtualHost.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Other;
4
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use Symfony\Component\Console\Input\InputInterface;
7 use Symfony\Component\Console\Output\OutputInterface;
8 use Symfony\Component\Console\Question\Question;
9
10 /**
11  * Implements other:apache-virtual-host command.
12  */
13 class ApacheVirtualHost extends BaseGenerator {
14
15   protected $name = 'other:apache-virtual-host';
16   protected $description = 'Generates an Apache site configuration file';
17   protected $alias = 'apache-virtual-host';
18   protected $destination = '/etc/apache2/sites-available';
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function interact(InputInterface $input, OutputInterface $output) {
24
25     $questions = [
26       'hostname' => new Question('Host name', 'example.com'),
27       'docroot' => new Question('Document root', '/var/www/{hostname}/public'),
28     ];
29
30     $this->collectVars($input, $output, $questions);
31
32     $this->addFile()
33       ->path('{hostname}.conf')
34       ->template('other/apache-virtual-host.twig');
35   }
36
37 }