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