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