1 | <?php |
||
16 | class InitCommand extends Command |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | protected function configure() |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | protected function execute(InputInterface $input, OutputInterface $output) |
||
71 | |||
72 | /** |
||
73 | * @param OutputInterface $output |
||
74 | * @param string $repositoryType |
||
75 | * |
||
76 | * @return bool |
||
77 | */ |
||
78 | protected function validateRepositoryType(OutputInterface $output, $repositoryType) |
||
79 | { |
||
80 | $availableTypeList = RepositoryType::all(); |
||
81 | if (!in_array($repositoryType, $availableTypeList)) { |
||
82 | $output->writeln(sprintf('<error>Unexpected type "%s" !</error>', $repositoryType)); |
||
83 | $output->writeln(sprintf( |
||
84 | '<info>Allowed type : %s </info>', |
||
85 | implode(' / ', array_map( |
||
86 | function ($availableMode) { |
||
87 | return sprintf('<comment>%s</comment>', $availableMode); |
||
88 | }, |
||
89 | $availableTypeList |
||
90 | )) |
||
91 | )); |
||
92 | |||
93 | return false; |
||
94 | } |
||
95 | |||
96 | return true; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @param InputInterface $input |
||
101 | * @param OutputInterface $output |
||
102 | * @param string $repositoryType |
||
103 | * @param string $repositorySubType |
||
104 | * |
||
105 | * @return InitRepositoryProcessor|ListTemplatesProcessor |
||
106 | * |
||
107 | * @throws \Twig_Error_Loader |
||
108 | */ |
||
109 | protected function getProcessor(InputInterface $input, OutputInterface $output, $repositoryType, $repositorySubType) |
||
141 | } |
||
142 |