| Conditions | 4 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 10 | public function getRequestJSON() |
|
| 42 | { |
||
| 43 | 10 | $json = []; |
|
| 44 | 10 | $allowed = ['url', 'referrer', 'user_agent', 'ip']; |
|
| 45 | 10 | foreach ($allowed as $name) { |
|
| 46 | 10 | if (isset($this->$name) && !empty($this->$name)) { |
|
| 47 | 10 | $json[$name] = $this->$name; |
|
| 48 | } |
||
| 49 | } |
||
| 50 | 10 | return json_encode($json); |
|
| 51 | } |
||
| 52 | } |
||
| 53 |