Conditions | 10 |
Paths | 5 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 2 |
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 |
||
43 | public function handle(): void |
||
44 | { |
||
45 | $webhook = $this->argument('webhook'); |
||
46 | $delete = $this->option('delete'); |
||
47 | $info = $this->option('info'); |
||
48 | |||
49 | if (! ($webhook || $delete || $info)) { |
||
50 | $this->error('Not enough arguments!'); |
||
51 | $this->error('php artisan telegram:webhook {webhook?} {--delete} {--info}'); |
||
52 | return; |
||
53 | } |
||
54 | |||
55 | if ($delete && ! $this->deleteWebhook()) { |
||
56 | return; |
||
57 | } |
||
58 | |||
59 | if ($webhook && ! $this->setWebhook($webhook)) { |
||
|
|||
60 | return; |
||
61 | } |
||
62 | |||
63 | if ($info && ! $this->showWebhookInfo()) { |
||
64 | return; |
||
65 | } |
||
66 | |||
67 | $this->info('All done!'); |
||
68 | } |
||
116 |