Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 2299-2332 (lines=34) @@
2296
                $element = $this->decorate($element, $attr, $inputFilter);
2297
                $form->add($element);
2298
            }
2299
            if (isset($element->line_radio)) {
2300
                $attr = $this->getAttributes($element->line_radio[0]);
2301
                $element = new Element\Radio($attr['name']);
2302
2303
                $element->setLabel($attr['label']);
2304
                $element->setAttributes(
2305
                    array(
2306
                        'name'      => $attr['name'],
2307
                        'required'  => $attr['required'],
2308
                        'allowEmpty'=> !$attr['required'],
2309
                        'class'     => $attr['class'],
2310
                        'id'        => $attr['id']
2311
                    )
2312
                );
2313
                $values = array();
2314
                foreach ($attr['innerData'] as $value) {
2315
                    $values[] = $value->label;
2316
                }
2317
                $element->setValueOptions($values);
2318
        
2319
                $options = array();
2320
                $options['encoding'] = 'UTF-8';
2321
                $options['disable_inarray_validator'] = true;
2322
        
2323
                $element->setOptions($options);
2324
        
2325
                $form->add($element);
2326
        
2327
                $inputFilter->add($factory->createInput(array(
2328
                    'name'     => $attr['name'],
2329
                    'required' => $attr['required'],
2330
                    'allowEmpty' => !$attr['required'],
2331
                )));
2332
            }
2333
            if (isset($element->line_checkbox)) {
2334
                $attr = $this->getAttributes($element->line_checkbox[0]);
2335
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2333-2366 (lines=34) @@
2330
                    'allowEmpty' => !$attr['required'],
2331
                )));
2332
            }
2333
            if (isset($element->line_checkbox)) {
2334
                $attr = $this->getAttributes($element->line_checkbox[0]);
2335
                $element = new Element\MultiCheckbox($attr['name']);
2336
        
2337
                $element->setLabel($attr['label']);
2338
                $element->setAttributes(
2339
                    array(
2340
                        'name'      => $attr['name'],
2341
                        'required'  => $attr['required'],
2342
                        'allowEmpty'=> !$attr['required'],
2343
                        'class'     => $attr['class'],
2344
                        'id'        => $attr['id']
2345
                    )
2346
                );
2347
2348
                $values = array();
2349
                foreach ($attr['innerData'] as $value) {
2350
                    $values[] = $value->label;
2351
                }
2352
                $element->setValueOptions($values);
2353
                $form->add($element);
2354
        
2355
                $options = array();
2356
                $options['encoding'] = 'UTF-8';
2357
                $options['disable_inarray_validator'] = true;
2358
        
2359
                $element->setOptions($options);
2360
        
2361
                $inputFilter->add($factory->createInput(array(
2362
                    'name'      => $attr['name'],
2363
                    'required'  => $attr['required'],
2364
                    'allowEmpty'=> !$attr['required'],
2365
                )));
2366
            }
2367
            if (isset($element->line_dropdown)) {
2368
                $attr = $this->getAttributes($element->line_dropdown[0]);
2369
                $element = new Element\Select($attr['name']);
@@ 2367-2399 (lines=33) @@
2364
                    'allowEmpty'=> !$attr['required'],
2365
                )));
2366
            }
2367
            if (isset($element->line_dropdown)) {
2368
                $attr = $this->getAttributes($element->line_dropdown[0]);
2369
                $element = new Element\Select($attr['name']);
2370
2371
                $element->setLabel($attr['label']);
2372
                $element->setAttributes(
2373
                    array(
2374
                        'name'      => $attr['name'],
2375
                        'required'  => $attr['required'],
2376
                        'allowEmpty'=> !$attr['required'],
2377
                        'class'     => $attr['class'],
2378
                        'id'        => $attr['id']
2379
                    )
2380
                );
2381
                $values = array();
2382
                foreach ($attr['dropdownValues'] as $value) {
2383
                    $values[] = $value->dropdown_label;
2384
                }
2385
                $element->setValueOptions($values);
2386
                $form->add($element);
2387
        
2388
                $options = array();
2389
                $options['encoding'] = 'UTF-8';
2390
                $options['disable_inarray_validator'] = true;
2391
        
2392
                $element->setOptions($options);
2393
        
2394
                $inputFilter->add($factory->createInput(array(
2395
                    'name'     => $attr['name'],
2396
                    'required' => $attr['required'],
2397
                    'allowEmpty' => !$attr['required'],
2398
                )));
2399
            }
2400
            if (isset($element->line_paragraph)) {
2401
                $attr = $this->getAttributes($element->line_paragraph[0]);
2402
                $element = new Element\Textarea($attr['name']);