Conditions | 1 |
Paths | 1 |
Total Lines | 98 |
Code Lines | 68 |
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 |
||
58 | public function init() |
||
59 | { |
||
60 | $elements = [ |
||
61 | 'general' => [ |
||
62 | 'priority' => 100, |
||
63 | 'label' => /*@translate*/ 'Basic Data', |
||
64 | 'options' => [ |
||
65 | 'label' => /*@translate*/ 'Basic Data' |
||
66 | ], |
||
67 | 'property' => true, |
||
68 | 'forms' => [ |
||
69 | |||
70 | 'locationForm' => array( |
||
71 | 'type' => 'Jobs/Base', |
||
72 | 'property' => true, |
||
73 | 'options' => array( |
||
74 | 'enable_descriptions' => true, |
||
75 | 'description' => /*@translate*/ 'Please choose a descriptive title and a location for your job posting ', |
||
76 | 'display_mode' => 'summary' |
||
77 | ) |
||
78 | ), |
||
79 | 'nameForm' => array( |
||
80 | 'type' => 'Jobs/CompanyName', |
||
81 | 'property' => true, |
||
82 | 'options' => array( |
||
83 | 'enable_descriptions' => true, |
||
84 | 'description' => /*@translate*/ 'Please choose the name of the hiring organization. The selected name defines the template of the job opening.', |
||
85 | 'display_mode' => 'summary' |
||
86 | ) |
||
87 | ), |
||
88 | 'salaryForm' => array( |
||
89 | 'type' => 'Jobs/Salary', |
||
90 | 'property' => true, |
||
91 | 'options' => array( |
||
92 | 'enable_descriptions' => true, |
||
93 | 'description' => /*@translate*/ 'Please choose a salary of your job opening.', |
||
94 | 'display_mode' => 'summary' |
||
95 | ) |
||
96 | ), |
||
97 | 'classifications' => [ |
||
98 | 'type' => 'Jobs/Classifications', |
||
99 | 'options' => [ |
||
100 | 'enable_descriptions' => true, |
||
101 | 'description' => /*@translate*/ 'Classify the job.', |
||
102 | 'display_mode' => 'summary', |
||
103 | ], |
||
104 | ], |
||
105 | 'portalForm' => array( |
||
106 | 'type' => 'Jobs/Multipost', |
||
107 | 'property' => true, |
||
108 | 'options' => array( |
||
109 | 'enable_descriptions' => true, |
||
110 | 'description' => /*@translate*/ 'Please choose the portals, where you wish to publish your job opening.', |
||
111 | 'display_mode' => 'summary' |
||
112 | ) |
||
113 | ), |
||
114 | 'customerNote' => [ |
||
115 | 'type' => 'Jobs/CustomerNote', |
||
116 | 'property' => true, |
||
117 | 'options' => [ |
||
118 | 'enable_descriptions' => true, |
||
119 | 'description' => /*@translate*/ 'If there is something you want us to know about this job offering, you can type it here.', |
||
120 | 'display_mode' => 'summary' |
||
121 | ] |
||
122 | ] |
||
123 | ], |
||
124 | ], |
||
125 | |||
126 | 'description' => [ |
||
127 | 'priority' => '80', |
||
128 | 'options' => [ 'label' => /*@translate*/ 'Create job opening' ], |
||
129 | 'property' => true, |
||
130 | 'forms' => [ |
||
131 | 'descriptionForm' => array( |
||
132 | 'type' => 'Jobs/Description', |
||
133 | 'property' => true, |
||
134 | ), |
||
135 | ], |
||
136 | ], |
||
137 | |||
138 | 'preview' => [ |
||
139 | 'priority' => 60, |
||
140 | 'options' => [ 'label' => /*@translate*/ 'Preview' ], |
||
141 | 'property' => true, |
||
142 | 'forms' => [ |
||
143 | 'previewForm' => array( |
||
144 | 'type' => 'Jobs/Preview', |
||
145 | 'property' => true, |
||
146 | ), |
||
147 | ], |
||
148 | ], |
||
149 | |||
150 | ]; |
||
151 | |||
152 | $this->setForms($elements); |
||
153 | |||
154 | $events = $this->getEventManager(); |
||
155 | $events->trigger(FormEvent::EVENT_INIT, $this); |
||
156 | } |
||
226 |