| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php namespace Nord\Lumen\Elasticsearch\Console; |
||
| 25 | public function handle() |
||
| 26 | { |
||
| 27 | $config = (string)$this->argument('config'); |
||
| 28 | |||
| 29 | $filePath = realpath($config); |
||
| 30 | |||
| 31 | if (!file_exists($filePath)) { |
||
| 32 | $this->error(sprintf("Configuration file '%s' does not exist.", $config)); |
||
| 33 | |||
| 34 | return 1; |
||
| 35 | } |
||
| 36 | |||
| 37 | $params = require($filePath); |
||
| 38 | $params = IndexNamePrefixer::getPrefixedIndexParameters($params); |
||
| 39 | |||
| 40 | $this->info(sprintf("Creating index '%s' ...", $params['index'])); |
||
| 41 | |||
| 42 | $this->elasticsearchService->indices()->create($params); |
||
| 43 | |||
| 44 | $this->info(sprintf("Index '%s' created.", $params['index'])); |
||
| 45 | |||
| 46 | return 0; |
||
| 47 | } |
||
| 49 |