| Conditions | 14 |
| Paths | 1 |
| Total Lines | 33 |
| Code Lines | 20 |
| 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 |
||
| 19 | public function register() |
||
| 20 | { |
||
| 21 | $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); |
||
| 22 | |||
| 23 | //Telescope::night(); |
||
| 24 | |||
| 25 | Telescope::filter(function (IncomingEntry $entry) { |
||
| 26 | if ($entry->type === EntryType::REQUEST |
||
| 27 | && isset($entry->content['uri']) |
||
| 28 | && str_contains($entry->content['uri'], 'horizon')) { |
||
| 29 | return false; |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($entry->type === EntryType::EVENT |
||
| 33 | && isset($entry->content['name']) |
||
| 34 | && str_contains($entry->content['name'], 'Horizon')) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | if ($entry->type === EntryType::REQUEST |
||
| 39 | && isset($entry->content['method']) |
||
| 40 | && $entry->content['method'] ==='OPTIONS'){ |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | if ($this->app->environment('local')) { |
||
| 45 | return true; |
||
| 46 | } |
||
| 47 | |||
| 48 | return $entry->isReportableException() || |
||
| 49 | $entry->isFailedJob() || |
||
| 50 | $entry->isScheduledTask() || |
||
| 51 | $entry->hasMonitoredTag(); |
||
| 52 | }); |
||
| 80 |