Conditions | 1 |
Paths | 1 |
Total Lines | 61 |
Code Lines | 37 |
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 namespace Anomaly\Streams\Platform\Installer\Console; |
||
63 | public function fire(Dispatcher $events, Application $application, AddonManager $manager) |
||
|
|||
64 | { |
||
65 | $this->dispatch(new ConfirmLicense($this)); |
||
66 | |||
67 | $data = new Collection(); |
||
68 | |||
69 | $this->dispatch(new SetStreamsData($data)); |
||
70 | $this->dispatch(new SetDatabaseData($data, $this)); |
||
71 | $this->dispatch(new SetApplicationData($data, $this)); |
||
72 | $this->dispatch(new SetAdminData($data, $this)); |
||
73 | $this->dispatch(new SetOtherData($data, $this)); |
||
74 | |||
75 | $this->dispatch(new WriteEnvironmentFile($data->all())); |
||
76 | $this->dispatch(new ReloadEnvironmentFile()); |
||
77 | |||
78 | $this->dispatch(new ConfigureDatabase()); |
||
79 | $this->dispatch(new SetDatabasePrefix()); |
||
80 | $this->dispatch(new LocateApplication()); |
||
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 | $this->dispatch(new RunInstallers($installers, $this)); |
||
90 | |||
91 | $this->call('env:set', ['line' => 'INSTALLED=true']); |
||
92 | |||
93 | $this->dispatch(new ReloadEnvironmentFile()); |
||
94 | |||
95 | $installers->add( |
||
96 | new Installer( |
||
97 | 'streams::installer.running_migrations', |
||
98 | function (Kernel $console) { |
||
99 | $console->call('migrate', ['--force' => true, '--no-addons' => true]); |
||
100 | } |
||
101 | ) |
||
102 | ); |
||
103 | |||
104 | $manager->register(); // Register all of our addons. |
||
105 | |||
106 | $events->fire(new StreamsHasInstalled($installers)); |
||
107 | |||
108 | $this->info('Running post installation tasks.'); |
||
109 | |||
110 | $this->dispatch(new LoadModuleSeeders($installers)); |
||
111 | $this->dispatch(new LoadExtensionSeeders($installers)); |
||
112 | |||
113 | $installers->add( |
||
114 | new Installer( |
||
115 | 'streams::installer.running_seeds', |
||
116 | function (Kernel $console) { |
||
117 | $console->call('db:seed'); |
||
118 | } |
||
119 | ) |
||
120 | ); |
||
121 | |||
122 | $this->dispatch(new RunInstallers($installers, $this)); |
||
123 | } |
||
124 | } |
||
125 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.