| Conditions | 1 |
| Paths | 1 |
| Total Lines | 86 |
| Code Lines | 69 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 static function configure(Table $table): Table |
||
| 20 | { |
||
| 21 | return $table |
||
| 22 | ->columns([ |
||
| 23 | TextColumn::make('template.name') |
||
| 24 | ->searchable() |
||
| 25 | ->sortable(), |
||
| 26 | TextColumn::make('user.name') |
||
| 27 | ->searchable() |
||
| 28 | ->sortable(), |
||
| 29 | BadgeColumn::make('channel') |
||
| 30 | ->colors([ |
||
| 31 | 'primary' => 'email', |
||
| 32 | 'success' => 'sms', |
||
| 33 | 'warning' => 'slack', |
||
| 34 | 'danger' => 'push', |
||
| 35 | ]), |
||
| 36 | TextColumn::make('subject') |
||
| 37 | ->limit(50) |
||
| 38 | ->searchable(), |
||
| 39 | BadgeColumn::make('status') |
||
| 40 | ->colors([ |
||
| 41 | 'warning' => 'pending', |
||
| 42 | 'success' => 'sent', |
||
| 43 | 'danger' => 'failed', |
||
| 44 | ]), |
||
| 45 | TextColumn::make('scheduled_at') |
||
| 46 | ->dateTime() |
||
| 47 | ->sortable(), |
||
| 48 | TextColumn::make('sent_at') |
||
| 49 | ->dateTime() |
||
| 50 | ->sortable(), |
||
| 51 | TextColumn::make('created_at') |
||
| 52 | ->dateTime() |
||
| 53 | ->sortable(), |
||
| 54 | ]) |
||
| 55 | ->filters([ |
||
| 56 | SelectFilter::make('channel') |
||
| 57 | ->options([ |
||
| 58 | 'email' => 'Email', |
||
| 59 | 'sms' => 'SMS', |
||
| 60 | 'slack' => 'Slack', |
||
| 61 | 'push' => 'Push Notification', |
||
| 62 | ]), |
||
| 63 | SelectFilter::make('status') |
||
| 64 | ->options([ |
||
| 65 | 'pending' => 'Pending', |
||
| 66 | 'sent' => 'Sent', |
||
| 67 | 'failed' => 'Failed', |
||
| 68 | ]), |
||
| 69 | Filter::make('scheduled_at') |
||
| 70 | ->form([ |
||
| 71 | DatePicker::make('scheduled_from'), |
||
| 72 | DatePicker::make('scheduled_until'), |
||
| 73 | ]) |
||
| 74 | ->query(function ($query, array $data) { |
||
| 75 | return $query |
||
| 76 | ->when( |
||
| 77 | $data['scheduled_from'], |
||
| 78 | fn($query) => $query->whereDate('scheduled_at', '>=', $data['scheduled_from']) |
||
| 79 | ) |
||
| 80 | ->when( |
||
| 81 | $data['scheduled_until'], |
||
| 82 | fn($query) => $query->whereDate('scheduled_at', '<=', $data['scheduled_until']) |
||
| 83 | ); |
||
| 84 | }), |
||
| 85 | ]) |
||
| 86 | ->recordActions([ |
||
| 87 | ViewAction::make(), |
||
| 88 | Action::make('resend') |
||
| 89 | ->icon('heroicon-o-arrow-path') |
||
| 90 | ->color('warning') |
||
| 91 | ->requiresConfirmation() |
||
| 92 | ->visible(fn($record) => $record->status === 'failed') |
||
| 93 | ->action(function ($record) { |
||
| 94 | // Resend the notification |
||
| 95 | $record->update(['status' => 'pending']); |
||
| 96 | \Usamamuneerchaudhary\Notifier\Jobs\SendNotificationJob::dispatch($record->id); |
||
| 97 | }), |
||
| 98 | ]) |
||
| 99 | ->toolbarActions([ |
||
| 100 | BulkActionGroup::make([ |
||
| 101 | DeleteBulkAction::make(), |
||
| 102 | ]), |
||
| 103 | ]) |
||
| 104 | ->defaultSort('created_at', 'desc'); |
||
| 105 | } |
||
| 108 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths