Conditions | 1 |
Paths | 1 |
Total Lines | 118 |
Code Lines | 79 |
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 |
||
40 | public function configureColumns(ColumnCollection $collection) |
||
41 | { |
||
42 | $collection->add(new Column([ |
||
43 | 'id' => 'id', |
||
44 | 'caption' => 'common.label.id', |
||
45 | 'appearance' => new Appearance([ |
||
46 | 'width' => 60, |
||
47 | 'visible' => false, |
||
48 | ]), |
||
49 | 'filter' => new Filter([ |
||
50 | 'type' => Filter::FILTER_BETWEEN, |
||
51 | ]), |
||
52 | ])); |
||
53 | |||
54 | $collection->add(new Column([ |
||
55 | 'id' => 'firstName', |
||
56 | 'caption' => 'common.label.first_name', |
||
57 | 'appearance' => new Appearance([ |
||
58 | 'width' => 60, |
||
59 | 'align' => Appearance::ALIGN_LEFT, |
||
60 | ]), |
||
61 | ])); |
||
62 | |||
63 | $collection->add(new Column([ |
||
64 | 'id' => 'lastName', |
||
65 | 'caption' => 'common.label.last_name', |
||
66 | 'appearance' => new Appearance([ |
||
67 | 'width' => 80, |
||
68 | 'align' => Appearance::ALIGN_LEFT, |
||
69 | ]), |
||
70 | ])); |
||
71 | |||
72 | $collection->add(new Column([ |
||
73 | 'id' => 'companyName', |
||
74 | 'caption' => 'client.label.address.company', |
||
75 | 'appearance' => new Appearance([ |
||
76 | 'width' => 100, |
||
77 | 'align' => Appearance::ALIGN_CENTER, |
||
78 | ]), |
||
79 | ])); |
||
80 | |||
81 | $collection->add(new Column([ |
||
82 | 'id' => 'vatId', |
||
83 | 'caption' => 'client.label.address.vat_id', |
||
84 | 'appearance' => new Appearance([ |
||
85 | 'width' => 60, |
||
86 | 'align' => Appearance::ALIGN_CENTER, |
||
87 | ]), |
||
88 | ])); |
||
89 | |||
90 | $collection->add(new Column([ |
||
91 | 'id' => 'email', |
||
92 | 'caption' => 'common.label.email', |
||
93 | 'appearance' => new Appearance([ |
||
94 | 'width' => 60, |
||
95 | 'align' => Appearance::ALIGN_CENTER, |
||
96 | ]), |
||
97 | ])); |
||
98 | |||
99 | $collection->add(new Column([ |
||
100 | 'id' => 'phone', |
||
101 | 'caption' => 'common.label.phone', |
||
102 | 'appearance' => new Appearance([ |
||
103 | 'width' => 80, |
||
104 | 'align' => Appearance::ALIGN_CENTER, |
||
105 | ]), |
||
106 | ])); |
||
107 | |||
108 | $collection->add(new Column([ |
||
109 | 'id' => 'groupName', |
||
110 | 'caption' => 'common.label.client_group', |
||
111 | 'filter' => new Filter([ |
||
112 | 'type' => Filter::FILTER_TREE, |
||
113 | 'filtered_column' => 'groupId', |
||
114 | 'options' => $this->clientGroupFilter->getOptions(), |
||
115 | ]), |
||
116 | 'appearance' => new Appearance([ |
||
117 | 'width' => 100, |
||
118 | 'align' => Appearance::ALIGN_CENTER, |
||
119 | ]), |
||
120 | ])); |
||
121 | |||
122 | $collection->add(new Column([ |
||
123 | 'id' => 'createdAt', |
||
124 | 'caption' => 'common.label.created_at', |
||
125 | 'filter' => new Filter([ |
||
126 | 'type' => Filter::FILTER_BETWEEN, |
||
127 | ]), |
||
128 | 'appearance' => new Appearance([ |
||
129 | 'width' => 40, |
||
130 | 'align' => Appearance::ALIGN_CENTER, |
||
131 | ]), |
||
132 | ])); |
||
133 | |||
134 | $collection->add(new Column([ |
||
135 | 'id' => 'lastActive', |
||
136 | 'caption' => 'client.label.last_active', |
||
137 | 'filter' => new Filter([ |
||
138 | 'type' => Filter::FILTER_BETWEEN, |
||
139 | ]), |
||
140 | 'appearance' => new Appearance([ |
||
141 | 'width' => 60, |
||
142 | 'align' => Appearance::ALIGN_CENTER, |
||
143 | ]), |
||
144 | ])); |
||
145 | |||
146 | $collection->add(new Column([ |
||
147 | 'id' => 'cart', |
||
148 | 'caption' => 'client.label.cart', |
||
149 | 'filter' => new Filter([ |
||
150 | 'type' => Filter::FILTER_BETWEEN, |
||
151 | ]), |
||
152 | 'appearance' => new Appearance([ |
||
153 | 'width' => 60, |
||
154 | 'align' => Appearance::ALIGN_CENTER, |
||
155 | ]), |
||
156 | ])); |
||
157 | } |
||
158 | |||
179 |