Conditions | 4 |
Paths | 6 |
Total Lines | 26 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function loadConfiguration() |
||
14 | { |
||
15 | $this->config += $this->defaults; |
||
16 | $builder = $this->getContainerBuilder(); |
||
17 | $config = DI\Helpers::expand($this->config, $builder->parameters); |
||
18 | if (!is_array($config['destinations'])) { |
||
19 | $config['destinations'] = ['default' => $config['destinations']]; |
||
20 | } |
||
21 | |||
22 | foreach ($config['destinations'] as $i => $destination) { |
||
23 | if (is_dir($destination)) { |
||
24 | $definition = $builder->addDefinition($this->prefix('driver.' . $i)) |
||
25 | ->setClass('h4kuna\Upload\Driver\LocalFilesystem', [$destination]); |
||
26 | } else { |
||
27 | $definition = $destination; |
||
28 | } |
||
29 | |||
30 | // Download |
||
31 | $builder->addDefinition($this->prefix('download.' . $i)) |
||
32 | ->setClass('h4kuna\Upload\Download', [$definition, '@http.request', '@http.response']); |
||
33 | |||
34 | // Upload |
||
35 | $builder->addDefinition($this->prefix('upload.' . $i)) |
||
36 | ->setClass('h4kuna\Upload\Upload', [$definition]); |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |