@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->extractEndpoint(EXT::LOCAL_ENDPOINT, 'localEndpoint', $tags, $data); |
47 | 47 | $this->extractEndpoint(EXT::REMOTE_ENDPOINT, 'remoteEndpoint', $tags, $data); |
48 | 48 | |
49 | - array_walk($tags, function (string &$v) { |
|
49 | + array_walk($tags, function(string &$v) { |
|
50 | 50 | // values type convert .. do nothing |
51 | 51 | }); |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | list($timestamp, $fields) = $log; |
58 | 58 | |
59 | 59 | $items = []; |
60 | - array_walk($fields, function ($v, $k) use (&$items) { |
|
60 | + array_walk($fields, function($v, $k) use (&$items) { |
|
61 | 61 | $items[] = "{$k}={$v}"; |
62 | 62 | }); |
63 | 63 |
@@ -28,11 +28,11 @@ |
||
28 | 28 | DI::set(Platform::class, $zpk); |
29 | 29 | DI::set(Observer::class, $zpk); |
30 | 30 | |
31 | - $app->starting()->add(static function () use ($zpk) { |
|
31 | + $app->starting()->add(static function() use ($zpk) { |
|
32 | 32 | return $zpk->init(); |
33 | 33 | }); |
34 | 34 | |
35 | - $app->stopping()->add(static function () use ($zpk) { |
|
35 | + $app->stopping()->add(static function() use ($zpk) { |
|
36 | 36 | return $zpk->leave(); |
37 | 37 | }); |
38 | 38 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->endpoint |
76 | 76 | ); |
77 | 77 | |
78 | - $this->daemon = Timer::loop(self::BATCH_INV, function () { |
|
78 | + $this->daemon = Timer::loop(self::BATCH_INV, function() { |
|
79 | 79 | $this->submitting(); |
80 | 80 | }); |
81 | 81 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | Timer::clear($this->daemon); |
89 | 89 | |
90 | - $closing = function () { |
|
90 | + $closing = function() { |
|
91 | 91 | $this->client->closed()->pended() && $this->client->close(); |
92 | 92 | }; |
93 | 93 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | private function submitting(Closure $then = null) : void |
122 | 122 | { |
123 | - $this->spouting(co(function (array $spans) use ($then) { |
|
123 | + $this->spouting(co(function(array $spans) use ($then) { |
|
124 | 124 | $request = new Request( |
125 | 125 | 'POST', |
126 | 126 | new Uri('http', $this->endpoint->host(), $this->endpoint->port(), $this->path), |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @var Response $response |
135 | 135 | */ |
136 | 136 | $response = yield $this->client->perform($request); |
137 | - if ((int)($response->getStatusCode() / 100) !== 2) { |
|
137 | + if ((int) ($response->getStatusCode() / 100) !== 2) { |
|
138 | 138 | logger('traced')->notice( |
139 | 139 | 'Server not accepting', |
140 | 140 | [ |
141 | - 'endpoint' => (string)$request->getUri(), |
|
142 | - 'error' => sprintf('#%d->%s', $response->getStatusCode(), (string)$response->getBody()), |
|
143 | - 'payload' => debug() ? (string)$request->getBody() : '[IGNORED]', |
|
141 | + 'endpoint' => (string) $request->getUri(), |
|
142 | + 'error' => sprintf('#%d->%s', $response->getStatusCode(), (string) $response->getBody()), |
|
143 | + 'payload' => debug() ? (string) $request->getBody() : '[IGNORED]', |
|
144 | 144 | ] |
145 | 145 | ); |
146 | 146 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | logger('traced')->notice( |
149 | 149 | 'Posting failed', |
150 | 150 | [ |
151 | - 'endpoint' => (string)$request->getUri(), |
|
151 | + 'endpoint' => (string) $request->getUri(), |
|
152 | 152 | 'error' => sprintf('%s::%s', get_class($e), $e->getMessage()), |
153 | 153 | ] |
154 | 154 | ); |
@@ -82,13 +82,13 @@ |
||
82 | 82 | 'zipkin' => [ZipkinHAV2::class, ZipkinJFV2::class], |
83 | 83 | 'udp' => [UDPRelays::class, ZipkinJFV2::class], |
84 | 84 | ], |
85 | - function (Transport $transport = null, Protocol $protocol = null) { |
|
85 | + function(Transport $transport = null, Protocol $protocol = null) { |
|
86 | 86 | $this->transport && $this->transport->disconnect(); |
87 | 87 | $this->transport = $transport; |
88 | 88 | $this->protocol = $protocol; |
89 | 89 | $this->changed($transport); |
90 | 90 | }, |
91 | - static function (Throwable $e) { |
|
91 | + static function(Throwable $e) { |
|
92 | 92 | logger('traced')->warning('Transport initialize failed', [ |
93 | 93 | 'p' => 'zipkin', |
94 | 94 | 'ec' => get_class($e), |
@@ -32,7 +32,7 @@ |
||
32 | 32 | Closure $setter, |
33 | 33 | Closure $failure = null |
34 | 34 | ) : void { |
35 | - $source->watching($conf, static function (string $dsn) use ($schemes, $setter, $failure) { |
|
35 | + $source->watching($conf, static function(string $dsn) use ($schemes, $setter, $failure) { |
|
36 | 36 | // parsing dsn |
37 | 37 | $parsed = parse_url($dsn) ?: []; |
38 | 38 |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | $this->uxdomain ? SWOOLE_SOCK_UNIX_DGRAM : SWOOLE_SOCK_UDP, |
58 | 58 | ($async = PHP_SAPI === 'cli') ? SWOOLE_SOCK_ASYNC : SWOOLE_SOCK_SYNC |
59 | 59 | ); |
60 | - $async && $this->client->on('connect', static function () { |
|
60 | + $async && $this->client->on('connect', static function() { |
|
61 | 61 | // do nothing |
62 | 62 | }); |
63 | - $async && $this->client->on('receive', static function () { |
|
63 | + $async && $this->client->on('receive', static function() { |
|
64 | 64 | // do nothing |
65 | 65 | }); |
66 | 66 | $this->client->connect($this->endpoint->host(), $this->endpoint->port()); |
67 | - $this->sender = function (string $data) { |
|
67 | + $this->sender = function(string $data) { |
|
68 | 68 | @$this->client->send($data); |
69 | 69 | }; |
70 | 70 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | SOCK_DGRAM, |
79 | 79 | $this->uxdomain ? IPPROTO_IP : SOL_UDP |
80 | 80 | ); |
81 | - $this->sender = function (string $data) { |
|
81 | + $this->sender = function(string $data) { |
|
82 | 82 | @socket_sendto( |
83 | 83 | $this->socket, |
84 | 84 | $data, |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | private function packing(string $payload) : string |
156 | 156 | { |
157 | 157 | return |
158 | - self::MAGIC . |
|
159 | - pack('N', strlen($this->identify)) . |
|
160 | - $this->identify . |
|
161 | - pack('N', strlen($payload)) . |
|
158 | + self::MAGIC. |
|
159 | + pack('N', strlen($this->identify)). |
|
160 | + $this->identify. |
|
161 | + pack('N', strlen($payload)). |
|
162 | 162 | $payload |
163 | 163 | ; |
164 | 164 | } |