1 | <?php |
||
19 | abstract class AbstractCommand extends Command implements ContainerAwareInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var SymfonyStyle |
||
23 | */ |
||
24 | protected $io; |
||
25 | |||
26 | /** |
||
27 | * @var boolean |
||
28 | */ |
||
29 | protected $debug = false; |
||
30 | |||
31 | /** |
||
32 | * @var ContainerInterface |
||
33 | */ |
||
34 | protected $container; |
||
35 | |||
36 | /** |
||
37 | * @var EventDispatcherInterface |
||
38 | */ |
||
39 | protected $eventDispatcher; |
||
40 | |||
41 | /** |
||
42 | * Build tasks from the configuration array. |
||
43 | * |
||
44 | * @param array $configuration |
||
45 | * |
||
46 | * @return Task[] |
||
47 | */ |
||
48 | 1 | protected function buildTasks(array $configuration) |
|
49 | { |
||
50 | 1 | $this->io->text('- Building tasks...'); |
|
51 | 1 | $builder = new TaskBuilder($this->debug); |
|
52 | |||
53 | 1 | $tasks = $builder->build($configuration); |
|
54 | |||
55 | 1 | $this->io->text('- Tasks build !'); |
|
56 | 1 | $this->io->newLine(); |
|
57 | |||
58 | 1 | return $tasks; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * Build the filter according to the configuration array. |
||
63 | * |
||
64 | * @param array $configuration |
||
65 | * |
||
66 | * @return FilterInterface[] |
||
67 | */ |
||
68 | 1 | protected function buildFilters(array $configuration) |
|
69 | { |
||
70 | 1 | $this->io->text('- Building filters...'); |
|
71 | 1 | $builder = new FilterBuilder($this->eventDispatcher); |
|
72 | |||
73 | 1 | $filters = $builder->build($configuration); |
|
74 | |||
75 | 1 | $this->io->text('- Filters build !'); |
|
76 | 1 | $this->io->newLine(); |
|
77 | |||
78 | 1 | return $filters; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * Load the configuration from a yml file. |
||
83 | * |
||
84 | * @param $configurationFile |
||
85 | * |
||
86 | * @return string[] |
||
87 | * |
||
88 | * @throws Exception |
||
89 | */ |
||
90 | protected function loadConfigurationFile($configurationFile) |
||
103 | |||
104 | /** |
||
105 | * Load the configuration from a yml file or the container, according to the given option. |
||
106 | * |
||
107 | * @param InputInterface $input |
||
108 | * |
||
109 | * @return array |
||
110 | * |
||
111 | * @throws Exception |
||
112 | */ |
||
113 | 1 | protected function loadConfiguration(InputInterface $input) |
|
129 | |||
130 | /** |
||
131 | * Sets the container. |
||
132 | * |
||
133 | * @param ContainerInterface|null $container A ContainerInterface instance or null |
||
134 | */ |
||
135 | 1 | public function setContainer(ContainerInterface $container = null) |
|
140 | } |
||
141 |