1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace ICanBoogie;
13
14 15 16 17 18
19 class PingOperation extends Operation
20 {
21 protected function validate(Errors $errors)
22 {
23 return true;
24 }
25
26 protected function process()
27 {
28 global $core;
29
30 $this->response->content_type = 'text/plain';
31
32 if (Session::exists())
33 {
34 $core->session;
35 }
36
37 $rc = 'pong';
38
39 if ($this->request['timer'] !== null)
40 {
41 $rc .= ', in ' . number_format((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 3, '.', '') . ' ms.';
42 }
43
44 return $rc;
45 }
46 }