| Conditions | 2 |
| Paths | 2 |
| Total Lines | 51 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| 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 namespace Anomaly\Streams\Platform\Installer\Console; |
||
| 61 | public function fire(Dispatcher $events, AddonManager $manager) |
||
| 62 | { |
||
| 63 | $data = new Collection(); |
||
| 64 | |||
| 65 | if (!$this->option('ready')) { |
||
| 66 | |||
| 67 | $this->dispatch(new ConfirmLicense($this)); |
||
| 68 | $this->dispatch(new SetStreamsData($data)); |
||
| 69 | $this->dispatch(new SetDatabaseData($data, $this)); |
||
| 70 | $this->dispatch(new SetApplicationData($data, $this)); |
||
| 71 | $this->dispatch(new SetAdminData($data, $this)); |
||
| 72 | $this->dispatch(new SetOtherData($data, $this)); |
||
| 73 | |||
| 74 | $this->dispatch(new WriteEnvironmentFile($data->all())); |
||
| 75 | } |
||
| 76 | |||
| 77 | $this->dispatch(new ReloadEnvironmentFile()); |
||
| 78 | |||
| 79 | $this->dispatch(new ConfigureDatabase()); |
||
| 80 | $this->dispatch(new SetDatabasePrefix()); |
||
| 81 | |||
| 82 | $installers = new InstallerCollection(); |
||
| 83 | |||
| 84 | $this->dispatch(new LoadCoreInstallers($installers)); |
||
| 85 | $this->dispatch(new LoadApplicationInstallers($installers)); |
||
| 86 | $this->dispatch(new LoadModuleInstallers($installers)); |
||
| 87 | $this->dispatch(new LoadExtensionInstallers($installers)); |
||
| 88 | |||
| 89 | $installers->add( |
||
| 90 | new Installer( |
||
| 91 | 'streams::installer.reloading_application', |
||
| 92 | function () use ($manager, $events) { |
||
| 93 | |||
| 94 | $this->call('env:set', ['line' => 'INSTALLED=true']); |
||
| 95 | |||
| 96 | $this->dispatch(new ReloadEnvironmentFile()); |
||
| 97 | $this->dispatch(new CreateEntrySearchIndexes()); |
||
| 98 | |||
| 99 | $manager->register(); // Register all of our addons. |
||
| 100 | } |
||
| 101 | ) |
||
| 102 | ); |
||
| 103 | |||
| 104 | $this->dispatch(new LoadBaseMigrations($installers)); |
||
| 105 | $this->dispatch(new LoadBaseSeeders($installers)); |
||
| 106 | |||
| 107 | $this->dispatch(new LoadModuleSeeders($installers)); |
||
| 108 | $this->dispatch(new LoadExtensionSeeders($installers)); |
||
| 109 | |||
| 110 | $this->dispatch(new RunInstallers($installers, $this)); |
||
| 111 | } |
||
| 112 | |||
| 125 |