fabe2a3d4a905d469d4c07b5b5cf5594457d4820
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / Plugin / RestResource.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Drupal_8\Plugin;
4
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9
10 /**
11  * Implements d8:plugin:rest-resource command.
12  */
13 class RestResource extends BaseGenerator {
14
15   protected $name = 'd8:plugin:rest-resource';
16   protected $description = 'Generates rest resource plugin';
17   protected $alias = 'rest-resource';
18   protected $label = 'REST resource';
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function interact(InputInterface $input, OutputInterface $output) {
24     $questions = Utils::defaultPluginQuestions();
25
26     $vars = &$this->collectVars($input, $output, $questions);
27     $vars['class'] = Utils::camelize($vars['plugin_label'] . 'Resource');
28
29     $this->addFile()
30       ->path('src/Plugin/rest/resource/{class}.php')
31       ->template('d8/plugin/rest-resource.twig');
32   }
33
34 }