| Conditions | 1 |
| Paths | 1 |
| Total Lines | 154 |
| Code Lines | 113 |
| 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 |
||
| 136 | public function buildForm() |
||
| 137 | { |
||
| 138 | $this |
||
| 139 | ->setAttr(['class' => 'submit-form', 'v-cloak' => 'v-cloak']) |
||
| 140 | ->setUrl(route('job.submit')) |
||
| 141 | ->add('id', 'hidden') |
||
| 142 | ->add('slug', 'hidden') |
||
| 143 | ->add('firm_id', 'hidden') |
||
| 144 | ->add('title', 'text', [ |
||
| 145 | 'rules' => 'min:2|max:60', |
||
| 146 | 'label' => 'Tytuł oferty', |
||
| 147 | 'required' => true, |
||
| 148 | 'help' => 'Pozostało <strong>${ charCounter(\'job.title\', 60) }</strong> znaków', |
||
| 149 | 'attr' => [ |
||
| 150 | 'placeholder' => 'Np. Senior Java Developer', |
||
| 151 | 'maxlength' => 60, |
||
| 152 | 'v-model' => 'job.title' |
||
| 153 | ], |
||
| 154 | 'row_attr' => [ |
||
| 155 | 'class' => 'col-sm-9' |
||
| 156 | ] |
||
| 157 | ]) |
||
| 158 | ->add('seniority_id', 'select', [ |
||
| 159 | 'rules' => 'integer', |
||
| 160 | 'label' => 'Staż pracy', |
||
| 161 | 'choices' => Job::getSeniorityList(), |
||
| 162 | 'empty_value' => '--', |
||
| 163 | 'row_attr' => [ |
||
| 164 | 'class' => 'col-sm-2' |
||
| 165 | ] |
||
| 166 | ]) |
||
| 167 | ->add('country_id', 'select', [ |
||
| 168 | 'rules' => 'required|integer', |
||
| 169 | 'choices' => Country::getCountriesList() |
||
| 170 | ]) |
||
| 171 | ->add('city', 'text', [ |
||
| 172 | 'rules' => 'string|city', |
||
| 173 | 'attr' => [ |
||
| 174 | 'placeholder' => 'Np. Wrocław, Warszawa' |
||
| 175 | ] |
||
| 176 | ]) |
||
| 177 | ->add('is_remote', 'checkbox', [ |
||
| 178 | 'label' => 'Możliwa praca zdalna w zakresie', |
||
| 179 | 'rules' => 'bool', |
||
| 180 | 'attr' => [ |
||
| 181 | 'id' => 'remote' |
||
| 182 | ], |
||
| 183 | 'label_attr' => [ |
||
| 184 | 'for' => 'remote' |
||
| 185 | ] |
||
| 186 | ]) |
||
| 187 | ->add('remote_range', 'select', [ |
||
| 188 | 'rules' => 'integer|min:10|max:100', |
||
| 189 | 'choices' => Job::getRemoteRangeList(), |
||
| 190 | 'attr' => [ |
||
| 191 | 'placeholder' => '--', |
||
| 192 | 'class' => 'input-sm input-inline', |
||
| 193 | 'style' => 'width: 100px' |
||
| 194 | ] |
||
| 195 | ]) |
||
| 196 | ->add('salary_from', 'text', [ |
||
| 197 | 'rules' => 'integer', |
||
| 198 | 'help' => 'Podanie tych informacji nie jest obowiązkowe, ale dzięki temu Twoja oferta zainteresuje więcej osób. Obiecujemy!', |
||
| 199 | 'attr' => [ |
||
| 200 | 'class' => 'input-inline' |
||
| 201 | ] |
||
| 202 | ]) |
||
| 203 | ->add('salary_to', 'text', [ |
||
| 204 | 'rules' => 'integer', |
||
| 205 | 'attr' => [ |
||
| 206 | 'class' => 'input-inline' |
||
| 207 | ] |
||
| 208 | ]) |
||
| 209 | ->add('is_gross', 'select', [ |
||
| 210 | 'rules' => 'required|boolean', |
||
| 211 | 'choices' => Job::getTaxList(), |
||
| 212 | 'attr' => [ |
||
| 213 | 'class' => 'input-inline' |
||
| 214 | ] |
||
| 215 | ]) |
||
| 216 | ->add('currency_id', 'select', [ |
||
| 217 | 'rules' => 'required|integer', |
||
| 218 | 'choices' => Currency::getCurrenciesList(), |
||
| 219 | 'attr' => [ |
||
| 220 | 'class' => 'input-inline' |
||
| 221 | ] |
||
| 222 | ]) |
||
| 223 | ->add('rate_id', 'select', [ |
||
| 224 | 'rules' => 'required|integer', |
||
| 225 | 'choices' => Job::getRatesList(), |
||
| 226 | 'attr' => [ |
||
| 227 | 'class' => 'input-inline' |
||
| 228 | ] |
||
| 229 | ]) |
||
| 230 | ->add('employment_id', 'select', [ |
||
| 231 | 'rules' => 'required|integer', |
||
| 232 | 'choices' => Job::getEmploymentList(), |
||
| 233 | 'attr' => [ |
||
| 234 | 'class' => 'input-inline' |
||
| 235 | ] |
||
| 236 | ]) |
||
| 237 | ->add('deadline', 'number', [ |
||
| 238 | 'label' => 'Data ważnosci oferty', |
||
| 239 | 'rules' => 'integer|min:1|max:365', |
||
| 240 | 'help' => 'Oferta będzie widoczna na stronie do dnia <strong>${ deadlineDate }</strong>', |
||
| 241 | 'attr' => [ |
||
| 242 | 'min' => 1, |
||
| 243 | 'max' => 365, |
||
| 244 | 'class' => 'input-inline', |
||
| 245 | 'v-model' => 'job.deadline' |
||
| 246 | ] |
||
| 247 | ]) |
||
| 248 | ->add('tags', 'collection', [ |
||
| 249 | 'child_attr' => [ |
||
| 250 | 'type' => 'child_form', |
||
| 251 | 'class' => TagsForm::class |
||
| 252 | ] |
||
| 253 | ]) |
||
| 254 | ->add('features', 'collection', [ |
||
| 255 | 'label' => 'Narzędzia oraz metodologia pracy', |
||
| 256 | 'help' => 'Zaznaczenie tych pól nie jest obowiązkowe, jednak wpływaja one na pozycję oferty na liście wyszukiwania.', |
||
| 257 | 'child_attr' => [ |
||
| 258 | 'type' => 'child_form', |
||
| 259 | 'class' => FeaturesForm::class |
||
| 260 | ] |
||
| 261 | ]) |
||
| 262 | ->add('description', 'textarea', [ |
||
| 263 | 'label' => 'Opis oferty (opcjonalnie)', |
||
| 264 | 'help' => 'Miejsce na szczegółowy opis oferty. Pole to jednak nie jest wymagane.', |
||
| 265 | 'style' => 'height: 140px', |
||
| 266 | 'row_attr' => [ |
||
| 267 | 'class' => 'form-group-border' |
||
| 268 | ] |
||
| 269 | ]) |
||
| 270 | ->add('enable_apply', 'choice', [ |
||
| 271 | 'multiple' => false, |
||
| 272 | 'choices' => [ |
||
| 273 | |||
| 274 | true => 'Zezwól na wysyłanie CV poprzez serwis 4programmers.net', |
||
| 275 | false => '...lub podaj informacje w jaki sposób kandydaci mogą aplikować na to stanowisko', |
||
| 276 | ] |
||
| 277 | ]) |
||
| 278 | ->add('recruitment', 'textarea', [ |
||
| 279 | 'rules' => 'required_if:enable_apply,0|string', |
||
| 280 | 'style' => 'height: 40px' |
||
| 281 | ]) |
||
| 282 | ->add('email', 'email', [ |
||
| 283 | 'rules' => 'sometimes|required|email', |
||
| 284 | 'help' => 'Podaj adres e-mail na jaki wyślemy Ci informacje o kandydatach. Adres e-mail nie będzie widoczny dla osób postronnych.' |
||
| 285 | ]); |
||
| 286 | |||
| 287 | $this->setupPlanFields(); |
||
| 288 | $this->setupDefaultValues(); |
||
| 289 | } |
||
| 290 | |||
| 349 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.