@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function register() |
39 | 39 | { |
40 | 40 | |
41 | - $configPath = __DIR__ . '/../config/cqrses.php'; |
|
41 | + $configPath = __DIR__.'/../config/cqrses.php'; |
|
42 | 42 | $this->mergeConfigFrom($configPath, 'cqrses'); |
43 | 43 | |
44 | 44 | $app = $this->app; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function boot() |
68 | 68 | { |
69 | - $configPath = __DIR__ . '/../config/cqrses.php'; |
|
69 | + $configPath = __DIR__.'/../config/cqrses.php'; |
|
70 | 70 | $this->publishes([$configPath => $this->getConfigPath()], 'config'); |
71 | 71 | |
72 | 72 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->app->singleton( |
114 | 114 | CommandBus::class, |
115 | - function () use ($middlewareChain) { |
|
115 | + function() use ($middlewareChain) { |
|
116 | 116 | return new \SmoothPhp\CommandBus\CommandBus($middlewareChain); |
117 | 117 | } |
118 | 118 | ); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if ($app['config']->get('cqrses.laravel_eventstore_enabled')) { |
136 | 136 | $app->bind( |
137 | 137 | EventStore::class, |
138 | - function (Application $application) { |
|
138 | + function(Application $application) { |
|
139 | 139 | return new LaravelEventStore( |
140 | 140 | $application->make(DatabaseManager::class), |
141 | 141 | $application->make(Serializer::class), |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $app->singleton( |
156 | 156 | EventBus::class, |
157 | - function (Application $application) { |
|
157 | + function(Application $application) { |
|
158 | 158 | $eventBus = $application->make($application['config']->get('cqrses.event_bus')); |
159 | 159 | |
160 | 160 | foreach ($application['config']->get('cqrses.event_bus_listeners') as $listener) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $app->singleton( |
175 | 175 | EventDispatcher::class, |
176 | - function (Application $application) { |
|
176 | + function(Application $application) { |
|
177 | 177 | /** @var EventDispatcher $dispatcher */ |
178 | 178 | $dispatcher = $application->make($application['config']->get('cqrses.event_dispatcher')); |
179 | 179 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | protected function getProjectionEventSubscribers(Application $app) |
194 | 194 | { |
195 | 195 | return collect($app['config']->get('cqrses.projections_service_providers'))->map( |
196 | - function ($projectionsServiceProvider) use ($app) { |
|
196 | + function($projectionsServiceProvider) use ($app) { |
|
197 | 197 | return $app->make($projectionsServiceProvider); |
198 | 198 | } |
199 | 199 | )->map( |
200 | - function (ProjectionServiceProvider $projectServiceProvider) use ($app) { |
|
200 | + function(ProjectionServiceProvider $projectServiceProvider) use ($app) { |
|
201 | 201 | return collect($projectServiceProvider->getProjections())->map( |
202 | - function ($projection) use ($app) { |
|
202 | + function($projection) use ($app) { |
|
203 | 203 | return $app->make($projection); |
204 | 204 | } |
205 | 205 | ); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | public function load($id) |
54 | 54 | { |
55 | 55 | $rows = $this->db->table($this->eventStoreTableName) |
56 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
57 | - ->where('uuid', $id) |
|
58 | - ->orderBy('playhead', 'asc') |
|
59 | - ->get(); |
|
56 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
57 | + ->where('uuid', $id) |
|
58 | + ->orderBy('playhead', 'asc') |
|
59 | + ->get(); |
|
60 | 60 | $events = []; |
61 | 61 | |
62 | 62 | foreach ($rows as $row) { |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | private function insertEvent(DomainMessage $domainMessage) |
100 | 100 | { |
101 | 101 | $this->db->table($this->eventStoreTableName) |
102 | - ->insert( |
|
103 | - [ |
|
104 | - 'uuid' => (string)$domainMessage->getId(), |
|
105 | - 'playhead' => $domainMessage->getPlayHead(), |
|
106 | - 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
107 | - 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
108 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
109 | - 'type' => $domainMessage->getType(), |
|
110 | - ] |
|
111 | - ); |
|
102 | + ->insert( |
|
103 | + [ |
|
104 | + 'uuid' => (string)$domainMessage->getId(), |
|
105 | + 'playhead' => $domainMessage->getPlayHead(), |
|
106 | + 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
107 | + 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
108 | + 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
109 | + 'type' => $domainMessage->getType(), |
|
110 | + ] |
|
111 | + ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | public function getEventsByType($eventTypes, $skip, $take) |
147 | 147 | { |
148 | 148 | $rows = $this->db->table($this->eventStoreTableName) |
149 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
150 | - ->whereIn('type', $eventTypes) |
|
151 | - ->skip($skip) |
|
152 | - ->take($take) |
|
153 | - ->orderBy('recorded_on', 'asc') |
|
154 | - ->get(); |
|
149 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
150 | + ->whereIn('type', $eventTypes) |
|
151 | + ->skip($skip) |
|
152 | + ->take($take) |
|
153 | + ->orderBy('recorded_on', 'asc') |
|
154 | + ->get(); |
|
155 | 155 | $events = []; |
156 | 156 | |
157 | 157 | foreach ($rows as $row) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function append($id, DomainEventStream $eventStream) |
78 | 78 | { |
79 | - $id = (string)$id; //Used to thrown errors if ID will not cast to string |
|
79 | + $id = (string) $id; //Used to thrown errors if ID will not cast to string |
|
80 | 80 | |
81 | 81 | $this->db->beginTransaction(); |
82 | 82 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | $this->db->table($this->eventStoreTableName) |
102 | 102 | ->insert( |
103 | 103 | [ |
104 | - 'uuid' => (string)$domainMessage->getId(), |
|
104 | + 'uuid' => (string) $domainMessage->getId(), |
|
105 | 105 | 'playhead' => $domainMessage->getPlayHead(), |
106 | 106 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
107 | 107 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
108 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
108 | + 'recorded_on' => (string) $domainMessage->getRecordedOn(), |
|
109 | 109 | 'type' => $domainMessage->getType(), |
110 | 110 | ] |
111 | 111 | ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $projectionRequest = collect(explode(',', $this->argument('projections'))); |
74 | 74 | |
75 | 75 | $projectionsServiceProviders = $projectionRequest->each( |
76 | - function ($projectionName) { |
|
76 | + function($projectionName) { |
|
77 | 77 | if (!isset($this->config->get('cqrses.projections_service_providers')[$projectionName])) { |
78 | 78 | $this->error("{$projectionName} Does not exist, check cqrses config"); |
79 | 79 | |
@@ -81,26 +81,26 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | )->map( |
84 | - function ($projectionName) { |
|
84 | + function($projectionName) { |
|
85 | 85 | return $this->application->make( |
86 | 86 | $this->config->get('cqrses.projections_service_providers')[$projectionName] |
87 | 87 | ); |
88 | 88 | } |
89 | 89 | )->each( |
90 | - function (ProjectionServiceProvider $projectionClass) { |
|
90 | + function(ProjectionServiceProvider $projectionClass) { |
|
91 | 91 | $this->downMigration($projectionClass); |
92 | 92 | } |
93 | 93 | )->each( |
94 | - function (ProjectionServiceProvider $projectionClass) { |
|
94 | + function(ProjectionServiceProvider $projectionClass) { |
|
95 | 95 | $this->upMigration($projectionClass); |
96 | 96 | } |
97 | 97 | ); |
98 | 98 | |
99 | 99 | /** @var Collection|Subscriber[] $projections */ |
100 | 100 | $projections = $projectionsServiceProviders->map( |
101 | - function (ProjectionServiceProvider $projectServiceProvider) { |
|
101 | + function(ProjectionServiceProvider $projectServiceProvider) { |
|
102 | 102 | return collect($projectServiceProvider->getProjections())->map( |
103 | - function ($projection) { |
|
103 | + function($projection) { |
|
104 | 104 | return $this->application->make($projection); |
105 | 105 | } |
106 | 106 | ); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | )->collapse(); |
109 | 109 | |
110 | 110 | $events = $projections->map( |
111 | - function (Subscriber $subscriber) { |
|
111 | + function(Subscriber $subscriber) { |
|
112 | 112 | return array_keys($subscriber->getSubscribedEvents()); |
113 | 113 | } |
114 | 114 | )->collapse()->map( |
115 | - function ($eventClassName) { |
|
115 | + function($eventClassName) { |
|
116 | 116 | return str_replace('\\', '.', $eventClassName); |
117 | 117 | } |
118 | 118 | ); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->output->progressAdvance($take > $eventCount ? $eventCount : $take); |
160 | 160 | } |
161 | 161 | $this->output->progressFinish(); |
162 | - $this->line((memory_get_peak_usage(true) / 1024 / 1024) . "mb Peak Usage", false); |
|
162 | + $this->line((memory_get_peak_usage(true) / 1024 / 1024)."mb Peak Usage", false); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $dispatcher = $this->application->make($this->config->get('cqrses.event_dispatcher')); |
188 | 188 | |
189 | 189 | $projections->each( |
190 | - function ($projection) use ($dispatcher) { |
|
190 | + function($projection) use ($dispatcher) { |
|
191 | 191 | $dispatcher->addSubscriber($projection); |
192 | 192 | } |
193 | 193 | ); |