Conditions | 3 |
Paths | 2 |
Total Lines | 78 |
Code Lines | 60 |
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 |
||
121 | public function setupUpdateOperation() |
||
122 | { |
||
123 | $this->crud->addField([ |
||
124 | 'name' => 'title', |
||
125 | 'label' => 'Title', |
||
126 | 'type' => 'text', |
||
127 | 'attributes' => [ |
||
128 | 'readonly' => 'readonly' |
||
129 | ] |
||
130 | ]); |
||
131 | $this->crud->addField([ |
||
132 | 'name' => 'salary_min', |
||
133 | 'type' => 'number', |
||
134 | 'label' => 'Minimum Salary', |
||
135 | ]); |
||
136 | $this->crud->addField([ |
||
137 | 'name' => 'salary_max', |
||
138 | 'type' => 'number', |
||
139 | 'label' => 'Maximum Salary', |
||
140 | ]); |
||
141 | $this->crud->addField([ |
||
142 | 'name' => 'noc', |
||
143 | 'type' => 'number', |
||
144 | 'label' => 'NOC Code', |
||
145 | ]); |
||
146 | $this->crud->addField([ |
||
147 | 'name' => 'open_date_time', |
||
148 | 'label' => 'Open Date', |
||
149 | 'type' => 'date_picker', |
||
150 | 'date_picker_options' => [ |
||
151 | 'todayBtn' => 'linked', |
||
152 | 'format' => 'yyyy-mm-dd', |
||
153 | ], |
||
154 | ]); |
||
155 | $this->crud->addField([ |
||
156 | 'name' => 'close_date_time', |
||
157 | 'label' => 'Close Date', |
||
158 | 'type' => 'date_picker', |
||
159 | 'date_picker_options' => [ |
||
160 | 'todayBtn' => 'linked', |
||
161 | 'format' => 'yyyy-mm-dd', |
||
162 | ], |
||
163 | ]); |
||
164 | $this->crud->addField([ |
||
165 | 'name' => 'start_date_time', |
||
166 | 'label' => 'Start Date', |
||
167 | 'type' => 'date_picker', |
||
168 | 'date_picker_options' => [ |
||
169 | 'todayBtn' => 'linked', |
||
170 | 'format' => 'yyyy-mm-dd', |
||
171 | ], |
||
172 | ]); |
||
173 | $this->crud->addField([ |
||
174 | 'name' => 'process_number', |
||
175 | 'type' => 'number', |
||
176 | 'label' => 'Process #', |
||
177 | ]); |
||
178 | $this->crud->addField([ |
||
179 | 'name' => 'priority_clearance_number', |
||
180 | 'type' => 'number', |
||
181 | 'label' => 'Priority Clearance #', |
||
182 | ]); |
||
183 | $this->crud->addField([ |
||
184 | 'name' => 'loo_issuance_date', |
||
185 | 'type' => 'date_picker', |
||
186 | 'label' => 'Letter of Offer Issuance Date', |
||
187 | 'date_picker_options' => [ |
||
188 | 'todayBtn' => 'linked', |
||
189 | 'format' => 'yyyy-mm-dd', |
||
190 | ], |
||
191 | ]); |
||
192 | if ($this->crud->getCurrentEntry() && |
||
193 | !$this->crud->getCurrentEntry()->published |
||
194 | ) { |
||
195 | $this->crud->addField([ |
||
196 | 'name' => 'published', |
||
197 | 'label' => 'Publish', |
||
198 | 'type' => 'checkbox' |
||
199 | ]); |
||
223 |