| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 19 |
| 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 namespace Anomaly\Streams\Platform\Ui\Table\Command; |
||
| 48 | public function handle() |
||
| 49 | { |
||
| 50 | /** |
||
| 51 | * Resolve and set the table model and stream. |
||
| 52 | */ |
||
| 53 | $this->dispatch(new SetTableModel($this->builder)); |
||
| 54 | $this->dispatch(new SetTableStream($this->builder)); |
||
| 55 | $this->dispatch(new SetDefaultParameters($this->builder)); |
||
| 56 | $this->dispatch(new SetRepository($this->builder)); |
||
| 57 | |||
| 58 | $this->dispatch(new SetTableOptions($this->builder)); |
||
| 59 | $this->dispatch(new SetDefaultOptions($this->builder)); |
||
| 60 | $this->dispatch(new SaveTableState($this->builder)); |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Before we go any further, authorize the request. |
||
| 64 | */ |
||
| 65 | $this->dispatch(new AuthorizeTable($this->builder)); |
||
| 66 | |||
| 67 | /* |
||
| 68 | * Build table views and mark active. |
||
| 69 | */ |
||
| 70 | $this->dispatch(new BuildViews($this->builder)); |
||
| 71 | $this->dispatch(new SetActiveView($this->builder)); |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Build table filters and flag active. |
||
| 75 | */ |
||
| 76 | $this->dispatch(new BuildFilters($this->builder)); |
||
| 77 | $this->dispatch(new SetActiveFilters($this->builder)); |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Build table actions and flag active. |
||
| 81 | */ |
||
| 82 | $this->dispatch(new BuildActions($this->builder)); |
||
| 83 | $this->dispatch(new SetActiveAction($this->builder)); |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Build table headers. |
||
| 87 | */ |
||
| 88 | $this->dispatch(new BuildHeaders($this->builder)); |
||
| 89 | $this->dispatch(new EagerLoadRelations($this->builder)); |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Get table entries. |
||
| 93 | */ |
||
| 94 | $this->dispatch(new GetTableEntries($this->builder)); |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Lastly table rows. |
||
| 98 | */ |
||
| 99 | $this->dispatch(new BuildRows($this->builder)); |
||
| 100 | } |
||
| 101 | } |
||
| 102 |