@@ -45,21 +45,21 @@ |
||
45 | 45 | |
46 | 46 | public function connect() { |
47 | 47 | $app = $this; |
48 | - $this->xmppclient->getConnection($this->config->url->value, function ($conn) use ($app) { |
|
48 | + $this->xmppclient->getConnection($this->config->url->value, function($conn) use ($app) { |
|
49 | 49 | $app->xmppconn = $conn; |
50 | 50 | if ($conn->connected) { |
51 | - Daemon::log('Jabberbot connected at '.$this->config->url->value); |
|
51 | + Daemon::log('Jabberbot connected at ' . $this->config->url->value); |
|
52 | 52 | $conn->presence('I\'m a robot.', 'chat'); |
53 | 53 | $conn->addEventHandler('message', function($msg) use ($conn) { |
54 | - Daemon::log('JabberBot: got message \''.$msg['body'].'\''); |
|
55 | - $conn->message($msg['from'], 'You just wrote: '.$msg['body']); // send the message back |
|
54 | + Daemon::log('JabberBot: got message \'' . $msg['body'] . '\''); |
|
55 | + $conn->message($msg['from'], 'You just wrote: ' . $msg['body']); // send the message back |
|
56 | 56 | }); |
57 | 57 | $conn->addEventHandler('disconnect', function() use ($app) { |
58 | 58 | $app->connect(); |
59 | 59 | }); |
60 | 60 | } |
61 | 61 | else { |
62 | - Daemon::log('Jabberbot: unable to connect ('.$this->config->url->value.')'); |
|
62 | + Daemon::log('Jabberbot: unable to connect (' . $this->config->url->value . ')'); |
|
63 | 63 | } |
64 | 64 | }); |
65 | 65 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $LockClient->job( |
34 | 34 | 'ExampleJobName', // name of the job |
35 | 35 | false, //wait? |
36 | - function($command,$jobname,$client) use ($req) { |
|
36 | + function($command, $jobname, $client) use ($req) { |
|
37 | 37 | if ($command === 'RUN') { |
38 | 38 | Daemon_TimedEvent::add(function($event) use ($req, $jobname, $client) { |
39 | 39 | Daemon::log('done'); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $req->out(':-)'); |
42 | 42 | $req->wakeup(); |
43 | 43 | $event->finish(); |
44 | - }, pow(10,6) * 1); |
|
44 | + }, pow(10, 6) * 1); |
|
45 | 45 | } |
46 | 46 | else { |
47 | 47 | $req->out(':-('); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function hello($pid) { |
14 | 14 | |
15 | - Daemon::$process->log('I got hello from '.$pid.'!'); |
|
15 | + Daemon::$process->log('I got hello from ' . $pid . '!'); |
|
16 | 16 | |
17 | 17 | } |
18 | 18 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $redis->lrange('mylist', 0, 10, function($redis) use ($name, $job) { // calling lrange Redis command |
58 | 58 | |
59 | - $job->setResult($name, $redis->result); // setting job result |
|
59 | + $job->setResult($name, $redis->result); // setting job result |
|
60 | 60 | |
61 | 61 | }); |
62 | 62 | }); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return integer Status. |
72 | 72 | */ |
73 | 73 | public function run() { |
74 | - try {$this->header('Content-Type: text/html');} catch (Exception $e) {} |
|
74 | + try {$this->header('Content-Type: text/html'); } catch (Exception $e) {} |
|
75 | 75 | ?> |
76 | 76 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
77 | 77 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } else { |
89 | 89 | echo '<h1>Something went wrong! We have no result.</h1>'; |
90 | 90 | } |
91 | -echo '<br />Request (http) took: '.round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'],6); |
|
91 | +echo '<br />Request (http) took: ' . round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'], 6); |
|
92 | 92 | ?> |
93 | 93 | </body> |
94 | 94 | </html> |
@@ -53,7 +53,7 @@ |
||
53 | 53 | * @return integer Status. |
54 | 54 | */ |
55 | 55 | public function run() { |
56 | - try {$this->header('Content-Type: text/html');} catch (Exception $e) {} |
|
56 | + try {$this->header('Content-Type: text/html'); } catch (Exception $e) {} |
|
57 | 57 | ?> |
58 | 58 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
59 | 59 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return integer Status. |
79 | 79 | */ |
80 | 80 | public function run() { |
81 | - try {$this->header('Content-Type: text/html');} catch (Exception $e) {} |
|
81 | + try {$this->header('Content-Type: text/html'); } catch (Exception $e) {} |
|
82 | 82 | |
83 | 83 | ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
84 | 84 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } else { |
101 | 101 | echo '<h1>Something went wrong! We have no result.</h1>'; |
102 | 102 | } |
103 | -echo '<br />Request (http) took: '.round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'],6); |
|
103 | +echo '<br />Request (http) took: ' . round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'], 6); |
|
104 | 104 | ?> |
105 | 105 | </body> |
106 | 106 | </html> |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return integer Status. |
71 | 71 | */ |
72 | 72 | public function run() { |
73 | - try {$this->header('Content-Type: text/html');} catch (Exception $e) {} |
|
73 | + try {$this->header('Content-Type: text/html'); } catch (Exception $e) {} |
|
74 | 74 | ?> |
75 | 75 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
76 | 76 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } else { |
88 | 88 | echo '<h1>Something went wrong! We have no result.</h1>'; |
89 | 89 | } |
90 | -echo '<br />Request (http) took: '.round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'],6); |
|
90 | +echo '<br />Request (http) took: ' . round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'], 6); |
|
91 | 91 | ?> |
92 | 92 | </body> |
93 | 93 | </html> |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | |
9 | 9 | class MemcacheClientConnection extends NetworkClientConnection { |
10 | 10 | |
11 | - public $result; // current result |
|
12 | - public $valueFlags; // flags of incoming value |
|
13 | - public $valueLength; // length of incoming value |
|
14 | - public $valueSize = 0; // size of received part of the value |
|
15 | - public $error; // error message |
|
16 | - public $key; // current incoming key |
|
11 | + public $result; // current result |
|
12 | + public $valueFlags; // flags of incoming value |
|
13 | + public $valueLength; // length of incoming value |
|
14 | + public $valueSize = 0; // size of received part of the value |
|
15 | + public $error; // error message |
|
16 | + public $key; // current incoming key |
|
17 | 17 | const STATE_DATA = 1; |
18 | 18 | public $EOL = "\r\n"; |
19 | 19 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | if ($this->state === self::STATE_DATA) { |
72 | 72 | if ($this->valueSize < $this->valueLength) { |
73 | - $n = $this->valueLength-$this->valueSize; |
|
73 | + $n = $this->valueLength - $this->valueSize; |
|
74 | 74 | $buflen = strlen($this->buf); |
75 | 75 | |
76 | 76 | if ($buflen > $n) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | Timer::$list[$id]->cancel(); |
66 | 66 | } |
67 | 67 | } |
68 | - public function timeout($timeout = null) { |
|
68 | + public function timeout($timeout = null) { |
|
69 | 69 | if ($timeout !== null) { |
70 | 70 | $this->lastTimeout = $timeout; |
71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function cancel() { |
75 | 75 | $this->ev->del(); |
76 | 76 | } |
77 | - public function finish(){ |
|
77 | + public function finish() { |
|
78 | 78 | $this->free(); |
79 | 79 | } |
80 | 80 | public function __destruct() { |