@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Cruft flake config interface. |
|
4 | - * |
|
5 | - * Implement this if you want some other way to configure machines. |
|
6 | - * |
|
7 | - * @author @davegardnerisme |
|
8 | - */ |
|
3 | + * Cruft flake config interface. |
|
4 | + * |
|
5 | + * Implement this if you want some other way to configure machines. |
|
6 | + * |
|
7 | + * @author @davegardnerisme |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | namespace Gendoria\CruftFlake\Config; |
11 | 11 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Fixed configuration. |
|
4 | - * |
|
5 | - * This is designed to be used where each machine **knows** what its machine |
|
6 | - * ID is - eg: via some kind of automatically deployed configuration |
|
7 | - * (puppet etc.) |
|
8 | - * |
|
9 | - * @author @davegardnerisme |
|
10 | - */ |
|
3 | + * Fixed configuration. |
|
4 | + * |
|
5 | + * This is designed to be used where each machine **knows** what its machine |
|
6 | + * ID is - eg: via some kind of automatically deployed configuration |
|
7 | + * (puppet etc.) |
|
8 | + * |
|
9 | + * @author @davegardnerisme |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace Gendoria\CruftFlake\Config; |
13 | 13 |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Cruft flake timer. |
|
4 | - * |
|
5 | - * @author @davegardnerisme |
|
6 | - */ |
|
3 | + * Cruft flake timer. |
|
4 | + * |
|
5 | + * @author @davegardnerisme |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | namespace Gendoria\CruftFlake\Timer; |
9 | 9 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Cruft flake timer interface. |
|
4 | - * |
|
5 | - * Implement this if you want some other way to provide time. |
|
6 | - * |
|
7 | - * @author @davegardnerisme |
|
8 | - */ |
|
3 | + * Cruft flake timer interface. |
|
4 | + * |
|
5 | + * Implement this if you want some other way to provide time. |
|
6 | + * |
|
7 | + * @author @davegardnerisme |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | namespace Gendoria\CruftFlake\Timer; |
11 | 11 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function generate() |
117 | 117 | { |
118 | - $t = (int) floor($this->timer->getUnixTimestamp() - $this->epoch); |
|
118 | + $t = (int) floor($this->timer->getUnixTimestamp()-$this->epoch); |
|
119 | 119 | if ($t !== $this->lastTime) { |
120 | 120 | $this->generateWithDifferentTime($t); |
121 | 121 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if ($t < $this->lastTime) { |
153 | 153 | throw new UnexpectedValueException( |
154 | 154 | 'Time moved backwards. We cannot generate IDs for ' |
155 | - .($this->lastTime - $t).' milliseconds' |
|
155 | + .($this->lastTime-$t).' milliseconds' |
|
156 | 156 | ); |
157 | 157 | } elseif ($t < 0) { |
158 | 158 | throw new UnexpectedValueException( |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function hexdec($hex) |
222 | 222 | { |
223 | 223 | $dec = 0; |
224 | - for ($i = strlen($hex) - 1, $e = 1; $i >= 0; $i--, $e = bcmul($e, 16)) { |
|
224 | + for ($i = strlen($hex)-1, $e = 1; $i >= 0; $i--, $e = bcmul($e, 16)) { |
|
225 | 225 | $factor = self::$hexdec[$hex[$i]]; |
226 | 226 | $dec = bcadd($dec, bcmul($factor, $e)); |
227 | 227 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $receiver = $this->getZmqSocket($this->dsn); |
69 | 69 | while (true) { |
70 | 70 | $msg = $receiver->recv(); |
71 | - $this->logger->debug('ZMQ server received command: ' . $msg); |
|
71 | + $this->logger->debug('ZMQ server received command: '.$msg); |
|
72 | 72 | $response = $this->runCommand($msg); |
73 | 73 | $receiver->send(json_encode($response)); |
74 | 74 | if ($this->debugMode) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | case 'STATUS': |
86 | 86 | return $this->commandStatus(); |
87 | 87 | default: |
88 | - $this->logger->debug('Unknown command received: ' . $msg); |
|
88 | + $this->logger->debug('Unknown command received: '.$msg); |
|
89 | 89 | return $this->createResponse('UNKNOWN COMMAND', 404); |
90 | 90 | } |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | try { |
101 | 101 | $response = $this->createResponse($this->generator->generate()); |
102 | 102 | } catch (Exception $e) { |
103 | - $this->logger->error('Generator error: ' . $e->getMessage(), array($e, $this)); |
|
103 | + $this->logger->error('Generator error: '.$e->getMessage(), array($e, $this)); |
|
104 | 104 | $response = $this->createResponse('ERROR', 500); |
105 | 105 | } |
106 | 106 |