Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 2218-2251 (lines=34) @@
2215
                $element = $this->decorate($element, $attr, $inputFilter);
2216
                $form->add($element);
2217
            }
2218
            if (isset($element->line_radio)) {
2219
                $attr = $this->getAttributes($element->line_radio[0]);
2220
                $element = new Element\Radio($attr['name']);
2221
2222
                $element->setLabel($attr['label']);
2223
                $element->setAttributes(
2224
                    array(
2225
                        'name'      => $attr['name'],
2226
                        'required'  => $attr['required'],
2227
                        'allowEmpty'=> !$attr['required'],
2228
                        'class'     => $attr['class'],
2229
                        'id'        => $attr['id']
2230
                    )
2231
                );
2232
                $values = array();
2233
                foreach ($attr['innerData'] as $value) {
2234
                    $values[] = $value->label;
2235
                }
2236
                $element->setValueOptions($values);
2237
        
2238
                $options = array();
2239
                $options['encoding'] = 'UTF-8';
2240
                $options['disable_inarray_validator'] = true;
2241
        
2242
                $element->setOptions($options);
2243
        
2244
                $form->add($element);
2245
        
2246
                $inputFilter->add($factory->createInput(array(
2247
                    'name'     => $attr['name'],
2248
                    'required' => $attr['required'],
2249
                    'allowEmpty' => !$attr['required'],
2250
                )));
2251
            }
2252
            if (isset($element->line_checkbox)) {
2253
                $attr = $this->getAttributes($element->line_checkbox[0]);
2254
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2252-2285 (lines=34) @@
2249
                    'allowEmpty' => !$attr['required'],
2250
                )));
2251
            }
2252
            if (isset($element->line_checkbox)) {
2253
                $attr = $this->getAttributes($element->line_checkbox[0]);
2254
                $element = new Element\MultiCheckbox($attr['name']);
2255
        
2256
                $element->setLabel($attr['label']);
2257
                $element->setAttributes(
2258
                    array(
2259
                        'name'      => $attr['name'],
2260
                        'required'  => $attr['required'],
2261
                        'allowEmpty'=> !$attr['required'],
2262
                        'class'     => $attr['class'],
2263
                        'id'        => $attr['id']
2264
                    )
2265
                );
2266
2267
                $values = array();
2268
                foreach ($attr['innerData'] as $value) {
2269
                    $values[] = $value->label;
2270
                }
2271
                $element->setValueOptions($values);
2272
                $form->add($element);
2273
        
2274
                $options = array();
2275
                $options['encoding'] = 'UTF-8';
2276
                $options['disable_inarray_validator'] = true;
2277
        
2278
                $element->setOptions($options);
2279
        
2280
                $inputFilter->add($factory->createInput(array(
2281
                    'name'      => $attr['name'],
2282
                    'required'  => $attr['required'],
2283
                    'allowEmpty'=> !$attr['required'],
2284
                )));
2285
            }
2286
            if (isset($element->line_dropdown)) {
2287
                $attr = $this->getAttributes($element->line_dropdown[0]);
2288
                $element = new Element\Select($attr['name']);
@@ 2286-2318 (lines=33) @@
2283
                    'allowEmpty'=> !$attr['required'],
2284
                )));
2285
            }
2286
            if (isset($element->line_dropdown)) {
2287
                $attr = $this->getAttributes($element->line_dropdown[0]);
2288
                $element = new Element\Select($attr['name']);
2289
2290
                $element->setLabel($attr['label']);
2291
                $element->setAttributes(
2292
                    array(
2293
                        'name'      => $attr['name'],
2294
                        'required'  => $attr['required'],
2295
                        'allowEmpty'=> !$attr['required'],
2296
                        'class'     => $attr['class'],
2297
                        'id'        => $attr['id']
2298
                    )
2299
                );
2300
                $values = array();
2301
                foreach ($attr['dropdownValues'] as $value) {
2302
                    $values[] = $value->dropdown_label;
2303
                }
2304
                $element->setValueOptions($values);
2305
                $form->add($element);
2306
        
2307
                $options = array();
2308
                $options['encoding'] = 'UTF-8';
2309
                $options['disable_inarray_validator'] = true;
2310
        
2311
                $element->setOptions($options);
2312
        
2313
                $inputFilter->add($factory->createInput(array(
2314
                    'name'     => $attr['name'],
2315
                    'required' => $attr['required'],
2316
                    'allowEmpty' => !$attr['required'],
2317
                )));
2318
            }
2319
            if (isset($element->line_paragraph)) {
2320
                $attr = $this->getAttributes($element->line_paragraph[0]);
2321
                $element = new Element\Textarea($attr['name']);