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