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