| Conditions | 5 | 
| Paths | 1 | 
| Total Lines | 56 | 
| Code Lines | 47 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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  | 
            ||
| 81 | public function columns(): array  | 
            ||
| 82 |     { | 
            ||
| 83 | return [  | 
            ||
| 84 |             Column::make('ID', 'id') | 
            ||
| 85 | ->sortable()  | 
            ||
| 86 | ->searchable(),  | 
            ||
| 87 |             Column::make('Name', 'name') | 
            ||
| 88 | ->sortable()  | 
            ||
| 89 | ->searchable(),  | 
            ||
| 90 |             Column::make('Parent', 'parent_id') | 
            ||
| 91 | ->format(  | 
            ||
| 92 | fn ($value, $row, Column $column) => $row->parent->name ?? '-'  | 
            ||
| 93 | )  | 
            ||
| 94 | ->sortable()  | 
            ||
| 95 | ->searchable()  | 
            ||
| 96 | ->collapseOnTablet(),  | 
            ||
| 97 |             Column::make('Root Parent', 'root_parent_id') | 
            ||
| 98 | ->format(  | 
            ||
| 99 | fn ($value, $row, Column $column) => $row->root_parent->name ?? '-'  | 
            ||
| 100 | )  | 
            ||
| 101 | ->sortable()  | 
            ||
| 102 | ->searchable()  | 
            ||
| 103 | ->collapseOnTablet(),  | 
            ||
| 104 |             Column::make('Model', 'model') | 
            ||
| 105 | ->sortable()  | 
            ||
| 106 | ->collapseOnTablet(),  | 
            ||
| 107 |             Column::make('Active', 'active') | 
            ||
| 108 | ->format(  | 
            ||
| 109 |                     fn ($value, $row, Column $column) => '<span class="badge badge-'.($row->getRawOriginal('active') ? 'success' : 'danger').' ">'.($row->getRawOriginal('active') ? 'Active' : 'Inactive').'</span>' | 
            ||
| 110 | )  | 
            ||
| 111 | ->html()  | 
            ||
| 112 | ->collapseOnTablet(),  | 
            ||
| 113 |             Column::make('Featured', 'featured') | 
            ||
| 114 | ->format(  | 
            ||
| 115 |                     fn ($value, $row, Column $column) => '<span class="badge badge-'.($row->getRawOriginal('active') ? 'success' : 'primary').' ">'.($row->getRawOriginal('active') ? 'Featured' : 'Not Featured').'</span>' | 
            ||
| 116 | )  | 
            ||
| 117 | ->html()  | 
            ||
| 118 | ->collapseOnTablet(),  | 
            ||
| 119 |             Column::make('Icon', 'icon') | 
            ||
| 120 | ->format(  | 
            ||
| 121 | fn ($value, $row, Column $column) => '<span class="'.$row->icon.' "></span>'  | 
            ||
| 122 | )  | 
            ||
| 123 | ->html()  | 
            ||
| 124 | ->collapseOnTablet(),  | 
            ||
| 125 |             Column::make('Color', 'color') | 
            ||
| 126 | ->format(  | 
            ||
| 127 | fn ($value, $row, Column $column) => '<span style="height:30px;width:50px;background-color:'.$row->color.'"></span>'  | 
            ||
| 128 | )  | 
            ||
| 129 | ->html()  | 
            ||
| 130 | ->collapseOnTablet(),  | 
            ||
| 131 |             Column::make('Action') | 
            ||
| 132 | ->label(  | 
            ||
| 133 |                     fn ($row, Column $column) => Blade::render('<x-adminetic-action :model="$model" route="category" :show="0" />', ['model' => $row]) | 
            ||
| 134 | )  | 
            ||
| 135 | ->html()  | 
            ||
| 136 | ->collapseOnTablet(),  | 
            ||
| 137 | ];  | 
            ||
| 140 |