| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 1 | public function geolocate(array $bodyParams = []): RequestInterface |
|
| 27 | { |
||
| 28 | // Google API request body format |
||
| 29 | 1 | $encoded = json_encode($bodyParams, JSON_UNESCAPED_SLASHES); |
|
| 30 | 1 | if (false === $encoded) { |
|
| 31 | // @codeCoverageIgnoreStart |
||
| 32 | // to get this error you must have something really fishy in $bodyParams |
||
| 33 | throw new ServiceException(json_last_error_msg()); |
||
| 34 | } |
||
| 35 | // @codeCoverageIgnoreEnd |
||
| 36 | |||
| 37 | 1 | return $this->getWithDefaults( |
|
|
|
|||
| 38 | 1 | 'https://www.googleapis.com/geolocation/v1/geolocate', |
|
| 39 | 1 | $this->queryParams([]) |
|
| 40 | 1 | ) |
|
| 41 | 1 | ->withMethod('POST') |
|
| 42 | 1 | ->withBody(new Body($encoded)); |
|
| 43 | } |
||
| 45 |