1 | <?php |
||
8 | class Response extends Provider |
||
9 | { |
||
10 | /** |
||
11 | * Redirect the client to a different URL |
||
12 | * |
||
13 | * @param $url |
||
14 | */ |
||
15 | public function redirect($url) |
||
21 | |||
22 | /** |
||
23 | * Output data as JSON |
||
24 | * |
||
25 | * @param object|array $data |
||
26 | */ |
||
27 | public function json($data) |
||
37 | |||
38 | /** |
||
39 | * Output data as a plain text or JSON, depending on its type |
||
40 | * |
||
41 | * @param object|object[]|string $data |
||
42 | */ |
||
43 | public function response($data) |
||
51 | |||
52 | /** |
||
53 | * Output data as plain text |
||
54 | * |
||
55 | * @param string $data |
||
56 | */ |
||
57 | public function plain($data) |
||
65 | |||
66 | private function executionTime() |
||
72 | |||
73 | /** |
||
74 | * Ensure we are encoding numeric properties as numbers, not strings |
||
75 | * |
||
76 | * @param object|array $input |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | protected function prepareOutput($input) |
||
88 | |||
89 | private function output($input) |
||
93 | |||
94 | private function outputArray($input) |
||
103 | |||
104 | /** |
||
105 | * Convert all numeric properties of an object into floats or integers |
||
106 | * |
||
107 | * @param object $object |
||
108 | * |
||
109 | * @return object |
||
110 | */ |
||
111 | protected function convertNumeric($object) |
||
125 | |||
126 | private function stringToNum($value) |
||
134 | } |
||
135 |