| Conditions | 1 |
| Paths | 1 |
| Total Lines | 90 |
| Code Lines | 78 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | 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 |
||
| 37 | public function form(Schema $schema): Schema |
||
| 38 | { |
||
| 39 | return $schema |
||
| 40 | ->schema([ |
||
| 41 | Section::make('General Settings') |
||
| 42 | ->schema([ |
||
| 43 | Forms\Components\Select::make('css_framework') |
||
| 44 | ->label('CSS Framework') |
||
| 45 | ->options([ |
||
| 46 | 'tailwind' => 'Tailwind CSS', |
||
| 47 | 'bootstrap' => 'Bootstrap', |
||
| 48 | ]) |
||
| 49 | ->default('tailwind') |
||
| 50 | ->required() |
||
| 51 | ->helperText('Choose the CSS framework for comment components'), |
||
| 52 | Forms\Components\TextInput::make('users_route_prefix') |
||
| 53 | ->label('Users Route Prefix') |
||
| 54 | ->default('users') |
||
| 55 | ->required(), |
||
| 56 | Forms\Components\TextInput::make('pagination_count') |
||
| 57 | ->label('Comments Per Page') |
||
| 58 | ->numeric() |
||
| 59 | ->default(10) |
||
| 60 | ->required(), |
||
| 61 | Forms\Components\Toggle::make('comment_nesting') |
||
| 62 | ->label('Enable Comment Nesting') |
||
| 63 | ->default(true), |
||
| 64 | Forms\Components\Toggle::make('read_only') |
||
| 65 | ->label('Read Only Mode') |
||
| 66 | ->helperText('Disable all commenting functionality') |
||
| 67 | ->default(false), |
||
| 68 | ]), |
||
| 69 | Section::make('Sorting & Display') |
||
| 70 | ->schema([ |
||
| 71 | Forms\Components\Select::make('default_sort') |
||
| 72 | ->label('Default Sort Order') |
||
| 73 | ->options([ |
||
| 74 | 'newest' => 'Newest First', |
||
| 75 | 'oldest' => 'Oldest First', |
||
| 76 | 'most_liked' => 'Most Liked', |
||
| 77 | 'most_replied' => 'Most Replied', |
||
| 78 | ]) |
||
| 79 | ->default('newest') |
||
| 80 | ->required(), |
||
| 81 | Forms\Components\Toggle::make('enable_sorting') |
||
| 82 | ->label('Enable Sorting') |
||
| 83 | ->default(true), |
||
| 84 | ]), |
||
| 85 | Section::make('Moderation') |
||
| 86 | ->schema([ |
||
| 87 | Forms\Components\Toggle::make('enable_reporting') |
||
| 88 | ->label('Enable Comment Reporting') |
||
| 89 | ->default(true), |
||
| 90 | Forms\Components\TagsInput::make('report_reasons') |
||
| 91 | ->label('Report Reasons') |
||
| 92 | ->placeholder('Add report reason') |
||
| 93 | ->default(['spam', 'inappropriate', 'offensive', 'other']), |
||
| 94 | ]), |
||
| 95 | Section::make('Features') |
||
| 96 | ->schema([ |
||
| 97 | Forms\Components\Select::make('theme') |
||
| 98 | ->label('Theme Mode') |
||
| 99 | ->options([ |
||
| 100 | 'light' => 'Light', |
||
| 101 | 'dark' => 'Dark', |
||
| 102 | 'auto' => 'Auto (System Preference)', |
||
| 103 | ]) |
||
| 104 | ->default('auto') |
||
| 105 | ->required(), |
||
| 106 | Forms\Components\Toggle::make('enable_emoji_picker') |
||
| 107 | ->label('Enable Emoji Picker') |
||
| 108 | ->default(true), |
||
| 109 | ]), |
||
| 110 | Section::make('Notifications') |
||
| 111 | ->schema([ |
||
| 112 | Forms\Components\Toggle::make('enable_notifications') |
||
| 113 | ->label('Enable Notifications') |
||
| 114 | ->default(false), |
||
| 115 | Forms\Components\CheckboxList::make('notification_channels') |
||
| 116 | ->label('Notification Channels') |
||
| 117 | ->options([ |
||
| 118 | 'database' => 'Database', |
||
| 119 | 'mail' => 'Email', |
||
| 120 | 'broadcast' => 'Broadcast (WebSocket)', |
||
| 121 | ]) |
||
| 122 | ->default(['database']) |
||
| 123 | ->visible(fn ($get) => $get('enable_notifications')), |
||
| 124 | ]), |
||
| 125 | ]) |
||
| 126 | ->statePath('data'); |
||
| 127 | } |
||
| 163 |
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