| Conditions | 2 |
| Paths | 1 |
| Total Lines | 56 |
| Code Lines | 44 |
| 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 |
||
| 43 | public function table(Table $table): Table |
||
| 44 | { |
||
| 45 | return $table |
||
| 46 | ->modifyQueryUsing(function ($query) { |
||
| 47 | return $query->withCount(['likes', 'reports']); |
||
| 48 | }) |
||
| 49 | ->recordTitleAttribute('id') |
||
| 50 | ->columns([ |
||
| 51 | Tables\Columns\TextColumn::make('id') |
||
| 52 | ->label('ID') |
||
| 53 | ->sortable(), |
||
| 54 | Tables\Columns\TextColumn::make('user.name') |
||
| 55 | ->label('User') |
||
| 56 | ->sortable() |
||
| 57 | ->searchable(), |
||
| 58 | Tables\Columns\TextColumn::make('body') |
||
| 59 | ->label('Reply') |
||
| 60 | ->limit(100) |
||
| 61 | ->wrap() |
||
| 62 | ->searchable() |
||
| 63 | ->formatStateUsing(function (Comment $record) { |
||
| 64 | return strip_tags($record->presenter()->markdownBody()); |
||
| 65 | }), |
||
| 66 | Tables\Columns\TextColumn::make('likes_count') |
||
| 67 | ->label('Likes') |
||
| 68 | ->sortable() |
||
| 69 | ->badge() |
||
| 70 | ->color('success') |
||
| 71 | ->default(0), |
||
| 72 | Tables\Columns\TextColumn::make('reports_count') |
||
| 73 | ->label('Reports') |
||
| 74 | ->sortable() |
||
| 75 | ->badge() |
||
| 76 | ->color(fn ($state) => ($state ?? 0) > 0 ? 'danger' : 'gray') |
||
| 77 | ->default(0), |
||
| 78 | Tables\Columns\TextColumn::make('created_at') |
||
| 79 | ->dateTime() |
||
| 80 | ->sortable(), |
||
| 81 | ]) |
||
| 82 | ->filters([ |
||
| 83 | // |
||
| 84 | ]) |
||
| 85 | ->headerActions([ |
||
| 86 | // Tables\Actions\CreateAction::make(), |
||
| 87 | ]) |
||
| 88 | ->recordActions([ |
||
| 89 | ViewAction::make(), |
||
| 90 | EditAction::make(), |
||
| 91 | DeleteAction::make(), |
||
| 92 | ]) |
||
| 93 | ->toolbarActions([ |
||
| 94 | BulkActionGroup::make([ |
||
| 95 | DeleteBulkAction::make(), |
||
| 96 | ]), |
||
| 97 | ]) |
||
| 98 | ->defaultSort('created_at', 'asc'); |
||
| 99 | } |
||
| 102 |
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