Conditions | 1 |
Paths | 1 |
Total Lines | 105 |
Code Lines | 70 |
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 |
||
35 | public function configureColumns(ColumnCollection $collection) |
||
36 | { |
||
37 | $collection->add(new Column([ |
||
38 | 'id' => 'id', |
||
39 | 'caption' => 'invoice.label.id', |
||
40 | 'appearance' => new Appearance([ |
||
41 | 'width' => 40, |
||
42 | 'visible' => false, |
||
43 | 'align' => Appearance::ALIGN_CENTER, |
||
44 | ]), |
||
45 | 'filter' => new Filter([ |
||
46 | 'type' => Filter::FILTER_BETWEEN, |
||
47 | ]), |
||
48 | ])); |
||
49 | |||
50 | $collection->add(new Column([ |
||
51 | 'id' => 'number', |
||
52 | 'caption' => 'invoice.label.number', |
||
53 | 'filter' => new Filter([ |
||
54 | 'type' => Filter::FILTER_INPUT, |
||
55 | ]), |
||
56 | 'sorting' => new Sorting([ |
||
57 | 'default_order' => Sorting::SORT_DIR_DESC, |
||
58 | ]), |
||
59 | 'appearance' => new Appearance([ |
||
60 | 'width' => 40, |
||
61 | 'align' => Appearance::ALIGN_CENTER, |
||
62 | ]), |
||
63 | ])); |
||
64 | |||
65 | $collection->add(new Column([ |
||
66 | 'id' => 'orderNumber', |
||
67 | 'caption' => 'invoice.label.order_number', |
||
68 | 'filter' => new Filter([ |
||
69 | 'type' => Filter::FILTER_INPUT, |
||
70 | ]), |
||
71 | 'sorting' => new Sorting([ |
||
72 | 'default_order' => Sorting::SORT_DIR_DESC, |
||
73 | ]), |
||
74 | 'appearance' => new Appearance([ |
||
75 | 'width' => 40, |
||
76 | 'align' => Appearance::ALIGN_CENTER, |
||
77 | ]), |
||
78 | ])); |
||
79 | |||
80 | $collection->add(new Column([ |
||
81 | 'id' => 'date', |
||
82 | 'caption' => 'invoice.label.date', |
||
83 | 'filter' => new Filter([ |
||
84 | 'type' => Filter::FILTER_BETWEEN, |
||
85 | ]), |
||
86 | 'appearance' => new Appearance([ |
||
87 | 'width' => 40, |
||
88 | 'align' => Appearance::ALIGN_CENTER, |
||
89 | ]), |
||
90 | ])); |
||
91 | |||
92 | $collection->add(new Column([ |
||
93 | 'id' => 'amountPaid', |
||
94 | 'caption' => 'invoice.label.amount_paid', |
||
95 | 'filter' => new Filter([ |
||
96 | 'type' => Filter::FILTER_BETWEEN, |
||
97 | ]), |
||
98 | 'appearance' => new Appearance([ |
||
99 | 'width' => 40, |
||
100 | 'align' => Appearance::ALIGN_CENTER, |
||
101 | ]), |
||
102 | ])); |
||
103 | |||
104 | $collection->add(new Column([ |
||
105 | 'id' => 'amountDue', |
||
106 | 'caption' => 'invoice.label.amount_due', |
||
107 | 'filter' => new Filter([ |
||
108 | 'type' => Filter::FILTER_BETWEEN, |
||
109 | ]), |
||
110 | 'appearance' => new Appearance([ |
||
111 | 'width' => 40, |
||
112 | 'align' => Appearance::ALIGN_CENTER, |
||
113 | ]), |
||
114 | ])); |
||
115 | |||
116 | $collection->add(new Column([ |
||
117 | 'id' => 'dueDate', |
||
118 | 'caption' => 'invoice.label.due_date', |
||
119 | 'filter' => new Filter([ |
||
120 | 'type' => Filter::FILTER_BETWEEN, |
||
121 | ]), |
||
122 | 'appearance' => new Appearance([ |
||
123 | 'width' => 40, |
||
124 | 'align' => Appearance::ALIGN_CENTER, |
||
125 | ]), |
||
126 | ])); |
||
127 | |||
128 | $collection->add(new Column([ |
||
129 | 'id' => 'createdAt', |
||
130 | 'caption' => 'invoice.label.created_at', |
||
131 | 'filter' => new Filter([ |
||
132 | 'type' => Filter::FILTER_BETWEEN, |
||
133 | ]), |
||
134 | 'appearance' => new Appearance([ |
||
135 | 'width' => 40, |
||
136 | 'align' => Appearance::ALIGN_CENTER, |
||
137 | ]), |
||
138 | ])); |
||
139 | } |
||
140 | |||
173 |