| Conditions | 1 |
| Paths | 1 |
| Total Lines | 56 |
| Code Lines | 27 |
| 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 |
||
| 111 | public function bindClasses(Container $app) |
||
| 112 | { |
||
| 113 | $app->singleton('trucker.urls', function ($app) { |
||
| 114 | return new Url\UrlGenerator($app); |
||
| 115 | }); |
||
| 116 | |||
| 117 | $app->singleton('trucker.config-manager', function ($app) { |
||
| 118 | return new Support\ConfigManager($app); |
||
| 119 | }); |
||
| 120 | |||
| 121 | $app->bind('trucker.instance-finder', function ($app) { |
||
| 122 | return new Finders\InstanceFinder($app); |
||
| 123 | }); |
||
| 124 | |||
| 125 | $app->bind('trucker.collection-finder', function ($app) { |
||
| 126 | return new Finders\CollectionFinder($app); |
||
| 127 | }); |
||
| 128 | |||
| 129 | $app->bind('trucker.response', function ($app) { |
||
| 130 | return new Responses\Response($app); |
||
| 131 | }); |
||
| 132 | |||
| 133 | $app->bind('trucker.model', function () { |
||
| 134 | return new Resource\Model(); |
||
| 135 | }); |
||
| 136 | |||
| 137 | //Factories |
||
| 138 | $app->bind('trucker.conditions', function ($app) { |
||
| 139 | return new Factories\QueryConditionFactory($app); |
||
| 140 | }); |
||
| 141 | |||
| 142 | $app->bind('trucker.transporter', function ($app) { |
||
| 143 | return new Factories\ApiTransporterFactory($app); |
||
| 144 | }); |
||
| 145 | |||
| 146 | $app->bind('trucker.order', function ($app) { |
||
| 147 | return new Factories\QueryResultOrderFactory($app); |
||
| 148 | }); |
||
| 149 | |||
| 150 | $app->bind('trucker.interpreter', function ($app) { |
||
| 151 | return new Factories\ResponseInterpreterFactory($app); |
||
| 152 | }); |
||
| 153 | |||
| 154 | $app->bind('trucker.error-handler', function ($app) { |
||
| 155 | return new Factories\ErrorHandlerFactory($app); |
||
| 156 | }); |
||
| 157 | |||
| 158 | $app->bind('trucker.request-factory', function ($app) { |
||
| 159 | return new Factories\RequestFactory($app); |
||
| 160 | }); |
||
| 161 | |||
| 162 | $app->bind('trucker.auth', function ($app) { |
||
| 163 | return new Factories\AuthFactory($app); |
||
| 164 | }); |
||
| 165 | |||
| 166 | return $app; |
||
| 167 | } |
||
| 200 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..