Conditions | 7 |
Paths | 5 |
Total Lines | 27 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | function dumpData($table, $style, $query) { |
||
28 | if ($_POST['format'] == 'json') { |
||
29 | if ($this->database) { |
||
30 | echo ",\n"; |
||
31 | } else { |
||
32 | $this->database = true; |
||
33 | echo "{\n"; |
||
34 | register_shutdown_function(array($this, '_database')); |
||
35 | } |
||
36 | $connection = connection(); |
||
37 | $result = $connection->query($query, 1); |
||
38 | if ($result) { |
||
39 | echo '"' . addcslashes($table, "\r\n\"\\") . "\": [\n"; |
||
40 | $first = true; |
||
41 | while ($row = $result->fetch_assoc()) { |
||
42 | echo ($first ? '' : ', '); |
||
43 | $first = false; |
||
44 | foreach ($row as $key => $val) { |
||
45 | json_row($key, $val); |
||
46 | } |
||
47 | json_row(''); |
||
48 | } |
||
49 | echo ']'; |
||
50 | } |
||
51 | return true; |
||
52 | } |
||
53 | } |
||
54 | |||
63 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.