@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $localAddress = $this->config[Configuration::ADDR]; |
86 | 86 | $this->shutdownSignal = null; |
87 | 87 | $this->metricsHandler->resetUsers($localAddress); |
88 | - $this->loop->addSignal(SIGINT, function ($signal) { |
|
88 | + $this->loop->addSignal(SIGINT, function($signal) { |
|
89 | 89 | $this->stop($signal, $this->loop); |
90 | 90 | }); |
91 | 91 | $this->loop->addPeriodicTimer( |
92 | 92 | 15, |
93 | 93 | fn() => $this->metricsHandler->getNbUsers()->then( |
94 | - function (int $nbUsers) { |
|
94 | + function(int $nbUsers) { |
|
95 | 95 | $memory = \memory_get_usage(true) / 1024 / 1024; |
96 | 96 | $this->logger()->debug("Users: {$nbUsers} - Memory: {$memory}MB"); |
97 | 97 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $this->transport->publish($topic, $message) |
144 | 144 | ->then(fn() => $this->storage->storeMessage($topic, $message)) |
145 | 145 | ->then( |
146 | - function () use ($topic, $message) { |
|
146 | + function() use ($topic, $message) { |
|
147 | 147 | $this->logger()->debug(\sprintf('Created message %s on topic %s', $message->getId(), $topic)); |
148 | 148 | } |
149 | 149 | ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | return $this->storage->storeSubscriptions($subscriptions) |
155 | 155 | ->then( |
156 | - function () use ($subscriptions) { |
|
156 | + function() use ($subscriptions) { |
|
157 | 157 | $promises = []; |
158 | 158 | foreach ($subscriptions as $subscription) { |
159 | 159 | $promises[] = $this->transport->publish( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | private function createSocketConnection(string $localAddress, LoopInterface $loop): Socket\Server |
184 | 184 | { |
185 | 185 | $socket = new Socket\Server($localAddress, $loop); |
186 | - $socket->on('connection', function (ConnectionInterface $connection) use ($localAddress) { |
|
186 | + $socket->on('connection', function(ConnectionInterface $connection) use ($localAddress) { |
|
187 | 187 | $this->metricsHandler->incrementUsers($localAddress); |
188 | 188 | $connection->on('close', fn() => $this->handleClosingConnection($connection, $localAddress)); |
189 | 189 | }); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | private function stop(int $signal, LoopInterface $loop): void |
240 | 240 | { |
241 | 241 | $this->shutdownSignal = $signal; |
242 | - $loop->futureTick(function () use ($loop) { |
|
242 | + $loop->futureTick(function() use ($loop) { |
|
243 | 243 | $loop->stop(); |
244 | 244 | }); |
245 | 245 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** @phpstan-ignore-next-line */ |
75 | 75 | return $this->async->keys($keyPattern) |
76 | 76 | ->then( |
77 | - function (array $keys) use ($topic) { |
|
77 | + function(array $keys) use ($topic) { |
|
78 | 78 | $promises = []; |
79 | 79 | foreach ($keys as $key) { |
80 | 80 | $promises[] = $this->async->get($key); /** @phpstan-ignore-line */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | return all($promises)->then( |
84 | 84 | fn(array $subscriptions) => \array_map( |
85 | - function (string $serialized) { |
|
85 | + function(string $serialized) { |
|
86 | 86 | $data = \json_decode($serialized, true); |
87 | 87 | |
88 | 88 | return new Subscription( |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | $subscriptions |
96 | 96 | ) |
97 | 97 | ) |
98 | - ->then(function (array $subscriptions) use ($topic): iterable { |
|
98 | + ->then(function(array $subscriptions) use ($topic): iterable { |
|
99 | 99 | foreach ($subscriptions as $subscription) { |
100 | - $matchtopic = null === $topic || TopicMatcher::matchesTopicSelectors( |
|
100 | + $matchtopic = null === $topic || TopicMatcher::matchesTopicSelectors( |
|
101 | 101 | $subscription->getTopic(), |
102 | 102 | [$topic] |
103 | 103 | ); |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | $stream = new ThroughStream(); |
39 | 39 | $this->hub->hook( |
40 | - function () use ($stream, $path, $subscriber, $topic) { |
|
40 | + function() use ($stream, $path, $subscriber, $topic) { |
|
41 | 41 | $this->hub->getActiveSubscriptions($subscriber, $topic) |
42 | 42 | ->then( |
43 | - function (iterable $subscriptions) use ($stream, $path) { |
|
43 | + function(iterable $subscriptions) use ($stream, $path) { |
|
44 | 44 | $result = [ |
45 | 45 | '@context' => 'https://mercure.rocks/', |
46 | 46 | 'id' => $path, |