eventManager = $eventManager; $this->connection = $connection; } public function dispatchMigrationEvent( string $eventName, MigrationPlanList $migrationsPlan, MigratorConfiguration $migratorConfiguration ): void { $event = $this->createMigrationEventArgs($migrationsPlan, $migratorConfiguration); $this->dispatchEvent($eventName, $event); } public function dispatchVersionEvent( string $eventName, MigrationPlan $plan, MigratorConfiguration $migratorConfiguration ): void { $event = $this->createMigrationsVersionEventArgs( $plan, $migratorConfiguration ); $this->dispatchEvent($eventName, $event); } private function dispatchEvent(string $eventName, ?EventArgs $args = null): void { $this->eventManager->dispatchEvent($eventName, $args); } private function createMigrationEventArgs( MigrationPlanList $migrationsPlan, MigratorConfiguration $migratorConfiguration ): MigrationsEventArgs { return new MigrationsEventArgs($this->connection, $migrationsPlan, $migratorConfiguration); } private function createMigrationsVersionEventArgs( MigrationPlan $plan, MigratorConfiguration $migratorConfiguration ): MigrationsVersionEventArgs { return new MigrationsVersionEventArgs( $this->connection, $plan, $migratorConfiguration ); } }