| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| Lines | 32 |
| Ratio | 54.24 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 30 | protected function registerCommands(Container $container) |
||
| 31 | { |
||
| 32 | $commands = []; |
||
| 33 | |||
| 34 | View Code Duplication | $commands[] = $this->registerCommand($container, MigrateCommand::class, function (Container $c) { |
|
| 35 | return new MigrateCommand( |
||
| 36 | $c->get(Args::class), |
||
| 37 | $c->get(OutputInterface::class), |
||
| 38 | $c->get(Migrator::class), |
||
| 39 | $c->get('migration-path') |
||
| 40 | ); |
||
| 41 | }); |
||
| 42 | |||
| 43 | $commands[] = $this->registerCommand($container, MigrateInstallCommand::class, function (Container $c) { |
||
| 44 | return new MigrateInstallCommand( |
||
| 45 | $c->get(Args::class), |
||
| 46 | $c->get(OutputInterface::class), |
||
| 47 | $c->get(DatabaseMigrationRepository::class) |
||
| 48 | ); |
||
| 49 | }); |
||
| 50 | |||
| 51 | $commands[] = $this->registerCommand($container, MigrateMakeCommand::class, function (Container $c) { |
||
| 52 | return new MigrateMakeCommand( |
||
| 53 | $c->get(Args::class), |
||
| 54 | $c->get(OutputInterface::class), |
||
| 55 | $c->get(MigrationCreator::class), |
||
| 56 | $c->get('migration-path') |
||
| 57 | ); |
||
| 58 | }); |
||
| 59 | |||
| 60 | View Code Duplication | $commands[] = $this->registerCommand($container, MigrateResetCommand::class, function (Container $c) { |
|
| 61 | return new MigrateResetCommand( |
||
| 62 | $c->get(Args::class), |
||
| 63 | $c->get(OutputInterface::class), |
||
| 64 | $c->get(Migrator::class), |
||
| 65 | $c->get('migration-path') |
||
| 66 | ); |
||
| 67 | }); |
||
| 68 | |||
| 69 | View Code Duplication | $commands[] = $this->registerCommand($container, MigrateRollbackCommand::class, function (Container $c) { |
|
| 70 | return new MigrateRollbackCommand( |
||
| 71 | $c->get(Args::class), |
||
| 72 | $c->get(OutputInterface::class), |
||
| 73 | $c->get(Migrator::class), |
||
| 74 | $c->get('migration-path') |
||
| 75 | ); |
||
| 76 | }); |
||
| 77 | |||
| 78 | View Code Duplication | $commands[] = $this->registerCommand($container, MigrateStatusCommand::class, function (Container $c) { |
|
| 79 | return new MigrateStatusCommand( |
||
| 80 | $c->get(Args::class), |
||
| 81 | $c->get(OutputInterface::class), |
||
| 82 | $c->get(Migrator::class), |
||
| 83 | $c->get('migration-path') |
||
| 84 | ); |
||
| 85 | }); |
||
| 86 | |||
| 87 | return $commands; |
||
| 88 | } |
||
| 89 | |||
| 112 |