| Conditions | 1 |
| Paths | 1 |
| Total Lines | 199 |
| Code Lines | 123 |
| 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 |
||
| 59 | public function register() |
||
| 60 | { |
||
| 61 | $this->app->singleton( |
||
| 62 | 'artomator.publish', |
||
| 63 | function ($app) { |
||
|
|
|||
| 64 | return new GeneratorPublishCommand(); |
||
| 65 | } |
||
| 66 | ); |
||
| 67 | |||
| 68 | $this->app->singleton( |
||
| 69 | 'artomator.api', |
||
| 70 | function ($app) { |
||
| 71 | return new APIGeneratorCommand(); |
||
| 72 | } |
||
| 73 | ); |
||
| 74 | |||
| 75 | $this->app->singleton( |
||
| 76 | 'artomator.scaffold', |
||
| 77 | function ($app) { |
||
| 78 | return new ScaffoldGeneratorCommand(); |
||
| 79 | } |
||
| 80 | ); |
||
| 81 | |||
| 82 | $this->app->singleton( |
||
| 83 | 'artomator.publish.layout', |
||
| 84 | function ($app) { |
||
| 85 | return new LayoutPublishCommand(); |
||
| 86 | } |
||
| 87 | ); |
||
| 88 | |||
| 89 | $this->app->singleton( |
||
| 90 | 'artomator.publish.templates', |
||
| 91 | function ($app) { |
||
| 92 | return new PublishTemplateCommand(); |
||
| 93 | } |
||
| 94 | ); |
||
| 95 | |||
| 96 | $this->app->singleton( |
||
| 97 | 'artomator.api_scaffold', |
||
| 98 | function ($app) { |
||
| 99 | return new APIScaffoldGeneratorCommand(); |
||
| 100 | } |
||
| 101 | ); |
||
| 102 | |||
| 103 | $this->app->singleton( |
||
| 104 | 'artomator.migration', |
||
| 105 | function ($app) { |
||
| 106 | return new MigrationGeneratorCommand(); |
||
| 107 | } |
||
| 108 | ); |
||
| 109 | |||
| 110 | $this->app->singleton( |
||
| 111 | 'artomator.model', |
||
| 112 | function ($app) { |
||
| 113 | return new ModelGeneratorCommand(); |
||
| 114 | } |
||
| 115 | ); |
||
| 116 | |||
| 117 | $this->app->singleton( |
||
| 118 | 'artomator.repository', |
||
| 119 | function ($app) { |
||
| 120 | return new RepositoryGeneratorCommand(); |
||
| 121 | } |
||
| 122 | ); |
||
| 123 | |||
| 124 | $this->app->singleton( |
||
| 125 | 'artomator.api.controller', |
||
| 126 | function ($app) { |
||
| 127 | return new APIControllerGeneratorCommand(); |
||
| 128 | } |
||
| 129 | ); |
||
| 130 | |||
| 131 | $this->app->singleton( |
||
| 132 | 'artomator.api.requests', |
||
| 133 | function ($app) { |
||
| 134 | return new APIRequestsGeneratorCommand(); |
||
| 135 | } |
||
| 136 | ); |
||
| 137 | |||
| 138 | $this->app->singleton( |
||
| 139 | 'artomator.api.tests', |
||
| 140 | function ($app) { |
||
| 141 | return new TestsGeneratorCommand(); |
||
| 142 | } |
||
| 143 | ); |
||
| 144 | |||
| 145 | $this->app->singleton( |
||
| 146 | 'artomator.scaffold.controller', |
||
| 147 | function ($app) { |
||
| 148 | return new ControllerGeneratorCommand(); |
||
| 149 | } |
||
| 150 | ); |
||
| 151 | |||
| 152 | $this->app->singleton( |
||
| 153 | 'artomator.scaffold.requests', |
||
| 154 | function ($app) { |
||
| 155 | return new RequestsGeneratorCommand(); |
||
| 156 | } |
||
| 157 | ); |
||
| 158 | |||
| 159 | $this->app->singleton( |
||
| 160 | 'artomator.scaffold.views', |
||
| 161 | function ($app) { |
||
| 162 | return new ViewsGeneratorCommand(); |
||
| 163 | } |
||
| 164 | ); |
||
| 165 | |||
| 166 | $this->app->singleton( |
||
| 167 | 'artomator.scaffold.routes', |
||
| 168 | function ($app) { |
||
| 169 | return new RoutesGeneratorCommand(); |
||
| 170 | } |
||
| 171 | ); |
||
| 172 | |||
| 173 | $this->app->singleton( |
||
| 174 | 'artomator.rollback', |
||
| 175 | function ($app) { |
||
| 176 | return new RollbackGeneratorCommand(); |
||
| 177 | } |
||
| 178 | ); |
||
| 179 | |||
| 180 | $this->app->singleton( |
||
| 181 | 'artomator.publish.user', |
||
| 182 | function ($app) { |
||
| 183 | return new PublishUserCommand(); |
||
| 184 | } |
||
| 185 | ); |
||
| 186 | |||
| 187 | $this->app->singleton( |
||
| 188 | 'artomator.graphql', |
||
| 189 | function ($app) { |
||
| 190 | return new GraphQLGeneratorCommand(); |
||
| 191 | } |
||
| 192 | ); |
||
| 193 | |||
| 194 | $this->app->singleton( |
||
| 195 | 'artomator.graphql_scaffold', |
||
| 196 | function ($app) { |
||
| 197 | return new GraphQLScaffoldGeneratorCommand(); |
||
| 198 | } |
||
| 199 | ); |
||
| 200 | |||
| 201 | $this->app->singleton( |
||
| 202 | 'artomator.graphql.query', |
||
| 203 | function ($app) { |
||
| 204 | return new GraphQLQueryGeneratorCommand(); |
||
| 205 | } |
||
| 206 | ); |
||
| 207 | |||
| 208 | $this->app->singleton( |
||
| 209 | 'artomator.graphql.mutations', |
||
| 210 | function ($app) { |
||
| 211 | return new GraphQLMutationsGeneratorCommand(); |
||
| 212 | } |
||
| 213 | ); |
||
| 214 | |||
| 215 | $this->app->singleton( |
||
| 216 | 'artomator.graphql.type', |
||
| 217 | function ($app) { |
||
| 218 | return new GraphQLTypeGeneratorCommand(); |
||
| 219 | } |
||
| 220 | ); |
||
| 221 | |||
| 222 | $this->app->singleton( |
||
| 223 | 'artomator.graphql.subscription', |
||
| 224 | function ($app) { |
||
| 225 | return new GraphQLSubscriptionGeneratorCommand(); |
||
| 226 | } |
||
| 227 | ); |
||
| 228 | |||
| 229 | parent::register(); |
||
| 230 | |||
| 231 | $this->commands( |
||
| 232 | [ |
||
| 233 | 'artomator.publish', |
||
| 234 | 'artomator.api', |
||
| 235 | 'artomator.scaffold', |
||
| 236 | 'artomator.api_scaffold', |
||
| 237 | 'artomator.publish.layout', |
||
| 238 | 'artomator.publish.templates', |
||
| 239 | 'artomator.migration', |
||
| 240 | 'artomator.model', |
||
| 241 | 'artomator.repository', |
||
| 242 | 'artomator.api.controller', |
||
| 243 | 'artomator.api.requests', |
||
| 244 | 'artomator.api.tests', |
||
| 245 | 'artomator.scaffold.controller', |
||
| 246 | 'artomator.scaffold.requests', |
||
| 247 | 'artomator.scaffold.views', |
||
| 248 | 'artomator.scaffold.routes', |
||
| 249 | 'artomator.rollback', |
||
| 250 | 'artomator.publish.user', |
||
| 251 | 'artomator.graphql', |
||
| 252 | 'artomator.graphql_scaffold', |
||
| 253 | 'artomator.graphql.query', |
||
| 254 | 'artomator.graphql.mutations', |
||
| 255 | 'artomator.graphql.type', |
||
| 256 | 'artomator.graphql.subscription', |
||
| 257 | Console\InstallCommand::class, |
||
| 258 | ] |
||
| 262 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.