| Conditions | 1 |
| Paths | 1 |
| Total Lines | 56 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 12 | public function __invoke() |
||
| 13 | { |
||
| 14 | return [ |
||
| 15 | 'console_routes' => [ |
||
| 16 | 'mogrations:execute' => [ |
||
| 17 | 'name' => 'mogrations:execute', |
||
| 18 | 'route' => 'mogrations:execute <moduleName> [--version=] [--write-sql] [--dry-run] [--up] [--down] [--query-time] ' . |
||
| 19 | '[--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]', |
||
| 20 | 'handler' => ExecuteCommand::class, |
||
| 21 | 'short_description' => 'Execute single module migration up or down', |
||
| 22 | ], |
||
| 23 | |||
| 24 | 'mogrations:generate' => [ |
||
| 25 | 'name' => 'mogrations:generate', |
||
| 26 | 'route' => 'mogrations:generate <moduleName> [--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]', |
||
| 27 | 'short_description' => 'Generate new blank module migration class', |
||
| 28 | 'handler' => GenerateCommand::class, |
||
| 29 | ], |
||
| 30 | 'mogrations:latest' => [ |
||
| 31 | 'name' => 'mogrations:latest', |
||
| 32 | 'route' => 'mogrations:latest <moduleName>', |
||
| 33 | 'handler' => LatestCommand::class, |
||
| 34 | 'short_description' => 'Output the latest module migration version number', |
||
| 35 | ], |
||
| 36 | 'mogrations:migrate' => [ |
||
| 37 | 'name' => 'mogrations:migrate', |
||
| 38 | 'route' => 'mogrations:migrate <moduleName> [--version=] [--dry-run] [--write-sql] [--query-time] ' . |
||
| 39 | '[--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]', |
||
| 40 | 'short_description' => 'Execute a module migration to a specified version or the latest available version', |
||
| 41 | 'handler' => MigrateCommand::class, |
||
| 42 | ], |
||
| 43 | 'mogrations:migrate-all' => [ |
||
| 44 | 'name' => 'mogrations:migrate-all', |
||
| 45 | 'route' => 'mogrations:migrate-all', |
||
| 46 | 'short_description' => 'Migrate all registered module migrations', |
||
| 47 | 'handler' => MigrateAllCommand::class, |
||
| 48 | ], |
||
| 49 | 'mogrations:status' => [ |
||
| 50 | 'name' => 'mogrations:status', |
||
| 51 | 'route' => 'mogrations:status <moduleName>', |
||
| 52 | 'handler' => StatusCommand::class, |
||
| 53 | 'short_description' => 'View the status of a set of module migrations' |
||
| 54 | ], |
||
| 55 | ], |
||
| 56 | 'dependencies' => [ |
||
| 57 | 'factories' => [ |
||
| 58 | ExecuteCommand::class => CommandFactory::class, |
||
| 59 | GenerateCommand::class => CommandFactory::class, |
||
| 60 | LatestCommand::class => CommandFactory::class, |
||
| 61 | MigrateCommand::class => CommandFactory::class, |
||
| 62 | MigrateAllCommand::class => MigrateAllCommandFactory::class, |
||
| 63 | StatusCommand::class => CommandFactory::class, |
||
| 64 | ] |
||
| 65 | ] |
||
| 66 | ]; |
||
| 67 | } |
||
| 68 | } |
||
| 70 |