@@ -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 | ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | private function mkSwoole() : void |
| 62 | 62 | { |
| 63 | 63 | $this->client = new Client(SWOOLE_SOCK_UDP, PHP_SAPI === 'cli' ? SWOOLE_SOCK_ASYNC : SWOOLE_SOCK_SYNC); |
| 64 | - $this->sender = function (string $data) { |
|
| 64 | + $this->sender = function(string $data) { |
|
| 65 | 65 | $this->client->sendto($this->endpoint->host(), $this->endpoint->port(), $data); |
| 66 | 66 | }; |
| 67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | private function mkSockets() : void |
| 72 | 72 | { |
| 73 | 73 | $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 74 | - $this->sender = function (string $data) { |
|
| 74 | + $this->sender = function(string $data) { |
|
| 75 | 75 | socket_sendto( |
| 76 | 76 | $this->socket, |
| 77 | 77 | $data, |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | private function packing(string $payload) : string |
| 119 | 119 | { |
| 120 | 120 | return |
| 121 | - self::MAGIC . |
|
| 122 | - pack('N', strlen($this->identify)) . |
|
| 123 | - $this->identify . |
|
| 124 | - pack('N', strlen($payload)) . |
|
| 121 | + self::MAGIC. |
|
| 122 | + pack('N', strlen($this->identify)). |
|
| 123 | + $this->identify. |
|
| 124 | + pack('N', strlen($payload)). |
|
| 125 | 125 | $payload |
| 126 | 126 | ; |
| 127 | 127 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | array $schemes, |
| 30 | 30 | Closure $setter |
| 31 | 31 | ) : void { |
| 32 | - $source->watching($conf, static function (string $dsn) use ($schemes, $setter) { |
|
| 32 | + $source->watching($conf, static function(string $dsn) use ($schemes, $setter) { |
|
| 33 | 33 | // parsing dsn |
| 34 | 34 | $parsed = parse_url($dsn) ?: []; |
| 35 | 35 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | 'zk-udp' => [UDPRelays::class, ZipkinJFV2::class], |
| 82 | 82 | 'zipkin' => [ZipkinHAV2::class, ZipkinJFV2::class], |
| 83 | 83 | ], |
| 84 | - function (Transport $transport = null, Protocol $protocol = null) { |
|
| 84 | + function(Transport $transport = null, Protocol $protocol = null) { |
|
| 85 | 85 | $this->transport && $this->transport->disconnect(); |
| 86 | 86 | $this->transport = $transport; |
| 87 | 87 | $this->protocol = $protocol; |