| Conditions | 6 |
| Paths | 6 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function complete($input, array $other = []) |
||
| 24 | { |
||
| 25 | $body = array_merge(['input' => $input], $other); |
||
| 26 | |||
| 27 | $result = $this->get(self::URL, $body); |
||
| 28 | |||
| 29 | switch($result['status']) { |
||
| 30 | case 'OK': |
||
| 31 | return $result['predictions']; |
||
| 32 | |||
| 33 | case 'ZERO_RESULTS': |
||
| 34 | return []; |
||
| 35 | |||
| 36 | case 'OVER_QUERY_LIMIT': |
||
| 37 | throw new QuotaLimitException(); |
||
| 38 | |||
| 39 | case 'REQUEST_DENIED': |
||
| 40 | throw new AuthenticationException(); |
||
| 41 | |||
| 42 | case 'INVALID_REQUEST': |
||
| 43 | throw new \InvalidArgumentException('The input is not correct for autocomplete.'); |
||
| 44 | |||
| 45 | default: |
||
| 46 | throw new \RuntimeException('This case is not supported, please report these to NeklandPlacesApi.'); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 |