| Conditions | 1 |
| Paths | 1 |
| Total Lines | 65 |
| 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 |
||
| 79 | public function buildForm() |
||
| 80 | { |
||
| 81 | $this |
||
| 82 | ->add('email', 'email', [ |
||
| 83 | 'rules' => 'required|string|max:200|email', |
||
| 84 | 'label' => 'E-mail', |
||
| 85 | 'help' => 'Nie wysyłamy spamu! Obiecujemy.', |
||
| 86 | 'attr' => [ |
||
| 87 | 'placeholder' => 'Np. [email protected]' |
||
| 88 | ] |
||
| 89 | ]) |
||
| 90 | ->add('email_confirmation', 'honeypot') |
||
| 91 | ->add('name', 'text', [ |
||
| 92 | 'rules' => 'required|string|max:50', |
||
| 93 | 'label' => 'Imię i nazwisko' |
||
| 94 | ]) |
||
| 95 | ->add('phone', 'text', [ |
||
| 96 | 'rules' => 'string|max:50', |
||
| 97 | 'label' => 'Numer telefonu', |
||
| 98 | 'help' => 'Podanie numeru telefonu nie jest obowiązkowe, ale pozwoli na szybki kontakt.' |
||
| 99 | ]) |
||
| 100 | ->add('cv', 'hidden', [ |
||
| 101 | 'label' => 'CV/Resume', |
||
| 102 | 'help' => 'CV/résumé z rozszerzeniem *.pdf, *.doc, *.docx lub *.rtf. Maksymalnie 5 MB.', |
||
| 103 | 'attr' => [ |
||
| 104 | 'placeholder' => 'Kliknij, aby dodać załącznik', |
||
| 105 | 'id' => 'uploader', |
||
| 106 | 'class' => 'form-control', |
||
| 107 | 'data-upload-url' => route('job.application.upload') |
||
| 108 | ], |
||
| 109 | 'template' => 'uploader' |
||
| 110 | ]) |
||
| 111 | ->add('github', 'text', [ |
||
| 112 | 'rules' => 'string|max:200', |
||
| 113 | 'label' => 'Konto Github', |
||
| 114 | 'help' => 'Nazwa użytkownika lub link do konta Github.', |
||
| 115 | 'row_attr' => [ |
||
| 116 | 'class' => 'github' |
||
| 117 | ] |
||
| 118 | ]) |
||
| 119 | ->add('salary', 'select', [ |
||
| 120 | 'label' => 'Minimalne oczekiwania wynagrodzenie', |
||
| 121 | 'empty_value' => 'Do negocjacji', |
||
| 122 | 'choices' => array_combine($this->salaryChoices, $this->salaryChoices) |
||
| 123 | ]) |
||
| 124 | ->add('dismissal_period', 'select', [ |
||
| 125 | 'label' => 'Obecny okres wypowiedzenia', |
||
| 126 | 'empty_value' => 'Nie określono', |
||
| 127 | 'choices' => array_combine($this->dismissalPeriodChoices, $this->dismissalPeriodChoices) |
||
| 128 | ]) |
||
| 129 | ->add('text', 'textarea', [ |
||
| 130 | 'rules' => 'string|required|max:5000', |
||
| 131 | 'label' => 'Wiadomość dla pracodawcy/zleceniodawcy', |
||
| 132 | 'help' => 'Taką wiadomość otrzyma osoba, która wystawiła ogłoszenie' |
||
| 133 | ]) |
||
| 134 | ->add('remember', 'checkbox', [ |
||
| 135 | 'label' => 'Zapamiętaj dane podane w formularzu' |
||
| 136 | ]) |
||
| 137 | ->add('submit', 'submit', [ |
||
| 138 | 'label' => 'Zapisz', |
||
| 139 | 'attr' => [ |
||
| 140 | 'data-submit-state' => 'Wysyłanie...' |
||
| 141 | ] |
||
| 142 | ]); |
||
| 143 | } |
||
| 144 | } |
||
| 145 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.