Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
33 | 10 | public function getRequestJSON() |
|
34 | { |
||
35 | 10 | $json = []; |
|
36 | 10 | $allowed = ['url', 'referrer', 'user_agent', 'ip']; |
|
37 | 10 | foreach ($allowed as $name) { |
|
38 | 10 | if (isset($this->$name) && !empty($this->$name)) { |
|
39 | 10 | $json[$name] = $this->$name; |
|
40 | } |
||
41 | } |
||
42 | 10 | return json_encode($json); |
|
43 | } |
||
44 | } |
||
45 |