| Conditions | 4 |
| Paths | 8 |
| Total Lines | 36 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 23 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 3 | public function indexActionGet() : object |
|
| 26 | { |
||
| 27 | 3 | $page = $this->di->get("page"); |
|
| 28 | 3 | $title = "Api"; |
|
| 29 | 3 | $request = $this->di->get("request"); |
|
| 30 | 3 | $location = $request->getGet("location"); |
|
|
|
|||
| 31 | 3 | $location = $request->getGet("ip"); |
|
| 32 | 3 | $type = $request->getGet("type"); |
|
| 33 | |||
| 34 | 3 | if ($type == "past") { |
|
| 35 | 1 | $past = "checked"; |
|
| 36 | } else { |
||
| 37 | 2 | $future = "checked"; |
|
| 38 | } |
||
| 39 | |||
| 40 | 3 | if (empty($location)) { |
|
| 41 | 1 | $ipgetcurrent = $this->di->get("ipgetcurrent"); |
|
| 42 | 1 | $location = $ipgetcurrent->getIP(); |
|
| 43 | } |
||
| 44 | |||
| 45 | 3 | if (empty($ip)) { |
|
| 46 | 3 | $ipgetcurrent = $this->di->get("ipgetcurrent"); |
|
| 47 | 3 | $ip = $ipgetcurrent->getIP(); |
|
| 48 | } |
||
| 49 | |||
| 50 | $data = [ |
||
| 51 | 3 | "location" => $location ?? null, |
|
| 52 | 3 | "checked1" => $future ?? null, |
|
| 53 | 3 | "checked2" => $past ?? null, |
|
| 54 | 3 | "ip" => $ip ?? null |
|
| 55 | ]; |
||
| 56 | |||
| 57 | 3 | $page->add("api/json", $data); |
|
| 58 | |||
| 59 | 3 | return $page->render([ |
|
| 60 | 3 | "title" => $title |
|
| 61 | ]); |
||
| 64 |