@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function configureChannel() |
37 | 37 | { |
38 | - $this->app->bind(ChannelContainer::class, function ($app) { |
|
38 | + $this->app->bind(ChannelContainer::class, function($app) { |
|
39 | 39 | $channel = new ChannelContainer($app->make(ConnectionContainer::class)); |
40 | 40 | $channel->setChannelOption(ConfigRepository::get('table_sync.channel')); |
41 | 41 | return $channel; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | private function configurePublish(array $config): void |
86 | 86 | { |
87 | - $this->app->singleton(Publisher::class, function ($app) use ($config) { |
|
87 | + $this->app->singleton(Publisher::class, function($app) use ($config) { |
|
88 | 88 | if (isset($config['custom_publisher'])) { |
89 | 89 | return $app->make($config['custom_publisher']); |
90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ]); |
95 | 95 | }); |
96 | 96 | |
97 | - $this->app->bind(Config\PublishMessage::class, function () use ($config) { |
|
97 | + $this->app->bind(Config\PublishMessage::class, function() use ($config) { |
|
98 | 98 | [ |
99 | 99 | 'appId' => $appId, |
100 | 100 | 'headers' => $headers, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return new Config\PublishMessage($appId, new AMQPTable($headers)); |
104 | 104 | }); |
105 | 105 | |
106 | - $this->app->bind(Config\Publisher::class, function () use ($config) { |
|
106 | + $this->app->bind(Config\Publisher::class, function() use ($config) { |
|
107 | 107 | [ |
108 | 108 | 'exchangeName' => $exchange, |
109 | 109 | 'confirmSelect' => $confirm, |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | |
116 | 116 | private function configureReceive(array $config): void |
117 | 117 | { |
118 | - $this->app->bind(MessageDataRetriever::class, function () use ($config) { |
|
118 | + $this->app->bind(MessageDataRetriever::class, function() use ($config) { |
|
119 | 119 | $config = $config['message_configs'] ?? []; |
120 | 120 | return new MessageDataRetriever($config); |
121 | 121 | }); |
122 | 122 | |
123 | - $this->app->bind(Config\Consumer::class, function ($app) use ($config) { |
|
123 | + $this->app->bind(Config\Consumer::class, function($app) use ($config) { |
|
124 | 124 | $queue = $config['queue'] ?? ''; |
125 | 125 | $handler = $config['custom_received_message_handler'] ?? QueueReceivedMessageHandler::class; |
126 | 126 | $microsecondsToSleep = $config['microseconds_to_sleep']; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $pidPath = $config['pid_path'] ?? storage_path('table_sync.pid'); |
132 | 132 | |
133 | - $this->app->bind(PidManager::class, function () use ($pidPath) { |
|
133 | + $this->app->bind(PidManager::class, function() use ($pidPath) { |
|
134 | 134 | return new PidManager($pidPath); |
135 | 135 | }); |
136 | 136 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | private function configureLogs(array $config): void |
141 | 141 | { |
142 | 142 | if (($logManager = $this->app->make('log')) instanceof LogManager) { |
143 | - $this->app->singleton('table_sync.logger', function () use ($logManager, $config) { |
|
143 | + $this->app->singleton('table_sync.logger', function() use ($logManager, $config) { |
|
144 | 144 | return $logManager->channel($config['channel']); |
145 | 145 | }); |
146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | private function configureConnection(): void |
156 | 156 | { |
157 | - $this->app->singleton(ConnectionContainer::class, function () { |
|
157 | + $this->app->singleton(ConnectionContainer::class, function() { |
|
158 | 158 | [ |
159 | 159 | 'host' => $host, |
160 | 160 | 'port' => $port, |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | $this->mergeConfigFrom($this->telegrafConfigPath(), 'telegraf'); |
27 | 27 | |
28 | 28 | if (($logManager = $this->app->make('log')) instanceof LogManager) { |
29 | - $logManager->extend('influxdb', function ($app, array $config) { |
|
29 | + $logManager->extend('influxdb', function($app, array $config) { |
|
30 | 30 | return (new InfluxDBLogChannel($app))($config); |
31 | 31 | }); |
32 | 32 | |
33 | - $logManager->extend('telegraf', function ($app, array $config) { |
|
33 | + $logManager->extend('telegraf', function($app, array $config) { |
|
34 | 34 | return (new TelegrafLogChannel($app))($config); |
35 | 35 | }); |
36 | 36 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function register() |
40 | 40 | { |
41 | - $this->app->singleton(InfluxDB::class, function ($app) { |
|
41 | + $this->app->singleton(InfluxDB::class, function($app) { |
|
42 | 42 | try { |
43 | 43 | $client = new InfluxClient( |
44 | 44 | config('influxdb.host'), |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $keys = array_keys($attributes); |
76 | 76 | |
77 | - $isArray = collect($keys)->every(function ($key) { |
|
77 | + $isArray = collect($keys)->every(function($key) { |
|
78 | 78 | return is_numeric($key); |
79 | 79 | }); |
80 | 80 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | ): array { |
89 | 89 | $handler = $this->resolveAdditionalDataHandler($additionalDataHandlerClass); |
90 | 90 | |
91 | - return array_map(function (array $item) use ($handler, $message) { |
|
91 | + return array_map(function(array $item) use ($handler, $message) { |
|
92 | 92 | return $handler->handle($message, $item); |
93 | 93 | }, $data); |
94 | 94 | } |
95 | 95 | |
96 | 96 | private function overrideData(array $data, array $override): array |
97 | 97 | { |
98 | - return array_map(function (array $item) use ($override) { |
|
98 | + return array_map(function(array $item) use ($override) { |
|
99 | 99 | foreach ($override as $from => $to) { |
100 | 100 | $item[$to] = $item[$from]; |
101 | 101 | unset($item[$from]); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $data = $this->addVersionToItems($messageData->getData(), $version); |
21 | 21 | |
22 | 22 | $columns = array_keys($data[0]); |
23 | - $columnString = implode(',', array_map(function (string $column): string { |
|
23 | + $columnString = implode(',', array_map(function(string $column): string { |
|
24 | 24 | return "\"{$column}\""; |
25 | 25 | }, $columns)); |
26 | 26 | |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | |
46 | 46 | private function addVersionToItems(array $items, float $version): array |
47 | 47 | { |
48 | - return array_map(function ($item) use ($version) { |
|
48 | + return array_map(function($item) use ($version) { |
|
49 | 49 | return array_merge($item, compact('version')); |
50 | 50 | }, $items); |
51 | 51 | } |
52 | 52 | |
53 | 53 | private function convertInsertValues(array $items): string |
54 | 54 | { |
55 | - $values = array_map(function (array $item) { |
|
55 | + $values = array_map(function(array $item) { |
|
56 | 56 | $item = $this->implodedPlaceholders($item); |
57 | 57 | return "({$item})"; |
58 | 58 | }, $items); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | private function updateSpec(array $columns): string |
64 | 64 | { |
65 | - $values = array_map(function (string $column) { |
|
65 | + $values = array_map(function(string $column) { |
|
66 | 66 | return "\"{$column}\" = EXCLUDED.{$column}"; |
67 | 67 | }, $columns); |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function implodedPlaceholders(array $items, string $placeholder = '?'): string |
73 | 73 | { |
74 | - return implode(',', array_map(function () use ($placeholder) { |
|
74 | + return implode(',', array_map(function() use ($placeholder) { |
|
75 | 75 | return $placeholder; |
76 | 76 | }, $items)); |
77 | 77 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $query = DB::table($message->getTable()); |
21 | 21 | foreach ($message->getData() as $itemData) { |
22 | - $query->orWhere(function (Builder $builder) use ($message, $itemData) { |
|
22 | + $query->orWhere(function(Builder $builder) use ($message, $itemData) { |
|
23 | 23 | $builder->where(Arr::only($itemData, $message->getTargetKeys())); |
24 | 24 | }); |
25 | 25 | } |
@@ -34,13 +34,13 @@ |
||
34 | 34 | { |
35 | 35 | pcntl_async_signals(true); |
36 | 36 | |
37 | - pcntl_signal(SIGTERM, function () use ($consumer) { |
|
37 | + pcntl_signal(SIGTERM, function() use ($consumer) { |
|
38 | 38 | $this->line('Shutting down by SIGTERM.'); |
39 | 39 | |
40 | 40 | $consumer->terminate(); |
41 | 41 | }); |
42 | 42 | |
43 | - pcntl_signal(SIGINT, function () use ($consumer) { |
|
43 | + pcntl_signal(SIGINT, function() use ($consumer) { |
|
44 | 44 | $this->line('Shutting down by SIGINT'); |
45 | 45 | |
46 | 46 | $consumer->terminate(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $keys = array_keys($attributes); |
64 | 64 | |
65 | - $isArray = collect($keys)->every(function ($key) { |
|
65 | + $isArray = collect($keys)->every(function($key) { |
|
66 | 66 | return is_numeric($key); |
67 | 67 | }); |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function addVersions(array $items, float $version): array |
73 | 73 | { |
74 | - return array_map(function ($item) use ($version) { |
|
74 | + return array_map(function($item) use ($version) { |
|
75 | 75 | return array_merge($item, compact('version')); |
76 | 76 | }, $items); |
77 | 77 | } |