| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 173 | private function registerBindings(): self |
||
| 174 | { |
||
| 175 | $this->app->bind( |
||
| 176 | Contracts\Filesystem::class, |
||
| 177 | Services\Filesystem::class |
||
| 178 | ); |
||
| 179 | |||
| 180 | $this->app->bind( |
||
| 181 | Contracts\Documentation\Publisher::class, |
||
| 182 | Services\Documentation\Publisher::class |
||
| 183 | ); |
||
| 184 | |||
| 185 | $this->app->bind( |
||
| 186 | Contracts\Documentation\Provider::class, |
||
| 187 | Services\Documentation\Provider::class |
||
| 188 | ); |
||
| 189 | |||
| 190 | $this->app->bind( |
||
| 191 | Contracts\MarkdownParser::class, |
||
| 192 | Services\MarkdownParser::class |
||
| 193 | ); |
||
| 194 | |||
| 195 | $this->app->bind( |
||
| 196 | Contracts\VCSCommandRunner::class, |
||
| 197 | Services\GitCommandRunner::class |
||
| 198 | ); |
||
| 199 | |||
| 200 | $this->app->bind( |
||
| 201 | Contracts\Product\Maker::class, |
||
| 202 | Factories\ProductMaker::class |
||
| 203 | ); |
||
| 204 | |||
| 205 | $this->app->bind( |
||
| 206 | Contracts\Product\Finder::class, |
||
| 207 | Services\Product\Finder::class |
||
| 208 | ); |
||
| 209 | |||
| 210 | $this->app->bind( |
||
| 211 | Contracts\Product\Publisher::class, |
||
| 212 | Services\Product\Publisher::class |
||
| 213 | ); |
||
| 214 | |||
| 215 | $this->app->singleton( |
||
| 216 | Contracts\ConfigProvider::class, |
||
| 217 | function (): Contracts\ConfigProvider { |
||
| 218 | return new Services\ConfigProvider( |
||
| 219 | resolve(Config::class) |
||
| 220 | ); |
||
| 221 | } |
||
| 222 | ); |
||
| 223 | |||
| 224 | $this->app->singleton( |
||
| 225 | Contracts\Logger::class, |
||
| 226 | function (): Contracts\Logger { |
||
| 227 | $logger = new Services\Logger(self::LOGGER_NAME); |
||
| 228 | $logFile = storage_path(sprintf('logs/%s.log', self::LOG_FILENAME)); |
||
| 229 | $logger->pushHandler(new StreamHandler($logFile, Services\Logger::DEBUG)); |
||
| 230 | |||
| 231 | return $logger; |
||
| 232 | } |
||
| 233 | ); |
||
| 234 | |||
| 235 | return $this; |
||
| 236 | } |
||
| 237 | |||
| 256 |