@@ -71,20 +71,20 @@ |
||
| 71 | 71 | protected function buildEventStoreTable() |
| 72 | 72 | { |
| 73 | 73 | Schema::connection($this->config->get('cqrses.eventstore_connection')) |
| 74 | - ->create( |
|
| 75 | - $this->config->get('cqrses.eventstore_table'), |
|
| 76 | - function (Blueprint $table) { |
|
| 77 | - $table->increments('id'); |
|
| 78 | - $table->string('uuid', 56); |
|
| 79 | - $table->integer('playhead')->unsigned(); |
|
| 80 | - $table->text('metadata'); |
|
| 81 | - $table->longText('payload'); |
|
| 82 | - $table->timestamp('recorded_on')->nullable()->index(); |
|
| 83 | - $table->string('type', 255)->index(); |
|
| 84 | - $table->unique(['uuid', 'playhead']); |
|
| 74 | + ->create( |
|
| 75 | + $this->config->get('cqrses.eventstore_table'), |
|
| 76 | + function (Blueprint $table) { |
|
| 77 | + $table->increments('id'); |
|
| 78 | + $table->string('uuid', 56); |
|
| 79 | + $table->integer('playhead')->unsigned(); |
|
| 80 | + $table->text('metadata'); |
|
| 81 | + $table->longText('payload'); |
|
| 82 | + $table->timestamp('recorded_on')->nullable()->index(); |
|
| 83 | + $table->string('type', 255)->index(); |
|
| 84 | + $table->unique(['uuid', 'playhead']); |
|
| 85 | 85 | |
| 86 | - $table->index(['id', 'type']); |
|
| 87 | - } |
|
| 88 | - ); |
|
| 86 | + $table->index(['id', 'type']); |
|
| 87 | + } |
|
| 88 | + ); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\Console; |
| 4 | 4 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | Schema::connection($this->config->get('cqrses.eventstore_connection')) |
| 74 | 74 | ->create( |
| 75 | 75 | $this->config->get('cqrses.eventstore_table'), |
| 76 | - function (Blueprint $table) { |
|
| 76 | + function(Blueprint $table) { |
|
| 77 | 77 | $table->increments('id'); |
| 78 | 78 | $table->string('uuid', 56); |
| 79 | 79 | $table->integer('playhead')->unsigned(); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\Console; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\Console; |
| 4 | 4 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $projectionRequest = collect(explode(',', $this->argument('projections'))); |
| 76 | 76 | |
| 77 | 77 | $projectionsServiceProviders = $projectionRequest->each( |
| 78 | - function ($projectionName) { |
|
| 78 | + function($projectionName) { |
|
| 79 | 79 | if (!isset($this->config->get('cqrses.projections_service_providers')[$projectionName])) { |
| 80 | 80 | $this->error("{$projectionName} Does not exist, check cqrses config"); |
| 81 | 81 | |
@@ -83,26 +83,26 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | )->map( |
| 86 | - function ($projectionName) { |
|
| 86 | + function($projectionName) { |
|
| 87 | 87 | return $this->application->make( |
| 88 | 88 | $this->config->get('cqrses.projections_service_providers')[$projectionName] |
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | )->each( |
| 92 | - function (ProjectionServiceProvider $projectionClass) { |
|
| 92 | + function(ProjectionServiceProvider $projectionClass) { |
|
| 93 | 93 | $this->downMigration($projectionClass); |
| 94 | 94 | } |
| 95 | 95 | )->each( |
| 96 | - function (ProjectionServiceProvider $projectionClass) { |
|
| 96 | + function(ProjectionServiceProvider $projectionClass) { |
|
| 97 | 97 | $this->upMigration($projectionClass); |
| 98 | 98 | } |
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | /** @var Collection|Subscriber[] $projections */ |
| 102 | 102 | $projections = $projectionsServiceProviders->map( |
| 103 | - function (ProjectionServiceProvider $projectServiceProvider) { |
|
| 103 | + function(ProjectionServiceProvider $projectServiceProvider) { |
|
| 104 | 104 | return collect($projectServiceProvider->getProjections())->map( |
| 105 | - function ($projection) { |
|
| 105 | + function($projection) { |
|
| 106 | 106 | return $this->application->make($projection); |
| 107 | 107 | } |
| 108 | 108 | ); |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | )->collapse(); |
| 111 | 111 | |
| 112 | 112 | $events = $projections->map( |
| 113 | - function (Subscriber $subscriber) { |
|
| 113 | + function(Subscriber $subscriber) { |
|
| 114 | 114 | return array_keys($subscriber->getSubscribedEvents()); |
| 115 | 115 | } |
| 116 | 116 | )->collapse()->map( |
| 117 | - function ($eventClassName) { |
|
| 117 | + function($eventClassName) { |
|
| 118 | 118 | return str_replace('\\', '.', $eventClassName); |
| 119 | 119 | } |
| 120 | 120 | ); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | protected function replayEvents($projections, $events) |
| 146 | 146 | { |
| 147 | 147 | $eventCount = $this->eventStore->getEventCountByTypes($events); |
| 148 | - $take = (int)$this->config->get('cqrses.rebuild_transaction_size', 1000); |
|
| 148 | + $take = (int) $this->config->get('cqrses.rebuild_transaction_size', 1000); |
|
| 149 | 149 | |
| 150 | 150 | $this->output->progressStart($eventCount); |
| 151 | 151 | $dispatcher = $this->buildAndRegisterDispatcher($projections); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $this->output->progressFinish(); |
| 164 | - $this->line((memory_get_peak_usage(true) / 1024 / 1024) . "mb Peak Usage", false); |
|
| 164 | + $this->line((memory_get_peak_usage(true) / 1024 / 1024)."mb Peak Usage", false); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | 196 | $projections->each( |
| 197 | - function ($projection) use ($dispatcher) { |
|
| 197 | + function($projection) use ($dispatcher) { |
|
| 198 | 198 | $dispatcher->addSubscriber($projection); |
| 199 | 199 | } |
| 200 | 200 | ); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\EventBus; |
| 4 | 4 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->queue->push( |
| 46 | 46 | QueueToEventDispatcher::class, |
| 47 | 47 | [ |
| 48 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 48 | + 'uuid' => (string) $domainMessage->getId(), |
|
| 49 | 49 | 'playhead' => $domainMessage->getPlayHead(), |
| 50 | 50 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
| 51 | 51 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\EventBus; |
| 4 | 4 | |
@@ -34,6 +34,6 @@ discard block |
||
| 34 | 34 | $name = explode('.', $domainMessage->getType()); |
| 35 | 35 | |
| 36 | 36 | $name = preg_replace('/(?!^)[A-Z]{2,}(?=[A-Z][a-z])|[A-Z][a-z]/', ' $0', end($name)); |
| 37 | - $this->log->debug(trim(ucwords($name)) . " ({$domainMessage->getType()})"); |
|
| 37 | + $this->log->debug(trim(ucwords($name))." ({$domainMessage->getType()})"); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\EventBus; |
| 4 | 4 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function fire($job, $data) |
| 38 | 38 | { |
| 39 | - $payload = (json_decode($data['payload'],true)); |
|
| 39 | + $payload = (json_decode($data['payload'], true)); |
|
| 40 | 40 | |
| 41 | 41 | $event = call_user_func([ |
| 42 | 42 | str_replace('.', '\\', $data['type']), |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter; |
| 4 | 4 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function register() |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - $configPath = __DIR__ . '/../config/cqrses.php'; |
|
| 42 | + $configPath = __DIR__.'/../config/cqrses.php'; |
|
| 43 | 43 | $this->mergeConfigFrom($configPath, 'cqrses'); |
| 44 | 44 | |
| 45 | 45 | $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 | ); |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\Console; |
| 4 | 4 | |