| Conditions | 4 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 45 | public function indexAction() |
||
| 46 | { |
||
| 47 | $query = $this->params()->fromQuery(); |
||
| 48 | |||
| 49 | switch($this->plugin){ |
||
| 50 | case 'photon': |
||
| 51 | /* @var Plugin\Photon $geoApi */ |
||
| 52 | $geoApi = $this->getPluginManager()->get('geo/photon'); |
||
| 53 | break; |
||
| 54 | case 'geo': |
||
| 55 | /* @var Plugin\Geo $geoApi */ |
||
| 56 | $geoApi = $this->getPluginManager()->get('geo/geo'); |
||
| 57 | break; |
||
| 58 | default: |
||
| 59 | throw new \RuntimeException('Invalid geo coder plugin'); |
||
| 60 | } |
||
| 61 | $result = array(); |
||
| 62 | if (!empty($query['q'])) { |
||
| 63 | $result = $geoApi($query['q'], $this->geoCoderUrl, $this->params('lang','de')); |
||
| 64 | } |
||
| 65 | $viewModel = new JsonModel($result); |
||
| 66 | return $viewModel; |
||
| 67 | } |
||
| 68 | } |