| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function getReportsAction(Request $request) |
||
| 28 | { |
||
| 29 | //TODO: may 'api_secret' be 'secret'? |
||
| 30 | if ($this->container->getParameter('api_secret') === 'ThisTokenIsNotSoSecretChangeIt') { |
||
| 31 | return new JsonResponse(['please change your api_secret to a secure one!']); |
||
| 32 | } |
||
| 33 | |||
| 34 | if ($request->get('key') !== $this->container->getParameter('api_secret')) { |
||
| 35 | return new JsonResponse([]); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** @var Reports $reports */ |
||
| 39 | $reports = $this->container->get('oc.geo_cache.reports'); |
||
| 40 | $geoCachesArray = explode('|', $request->get('geocaches')); |
||
| 41 | |||
| 42 | $geoCaches = $reports->getReportStatus($geoCachesArray); |
||
| 43 | |||
| 44 | return new JsonResponse($geoCaches); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |