Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 2352-2385 (lines=34) @@
2349
                $element = $this->decorate($element, $attr, $inputFilter);
2350
                $form->add($element);
2351
            }
2352
            if (isset($element->line_radio)) {
2353
                $attr = $this->getAttributes($element->line_radio[0]);
2354
                $element = new Element\Radio($attr['name']);
2355
2356
                $element->setLabel($attr['label']);
2357
                $element->setAttributes(
2358
                    array(
2359
                        'name'      => $attr['name'],
2360
                        'required'  => $attr['required'],
2361
                        'allowEmpty'=> !$attr['required'],
2362
                        'class'     => $attr['class'],
2363
                        'id'        => $attr['id']
2364
                    )
2365
                );
2366
                $values = array();
2367
                foreach ($attr['innerData'] as $value) {
2368
                    $values[] = $value->label;
2369
                }
2370
                $element->setValueOptions($values);
2371
2372
                $options = array();
2373
                $options['encoding'] = 'UTF-8';
2374
                $options['disable_inarray_validator'] = true;
2375
2376
                $element->setOptions($options);
2377
2378
                $form->add($element);
2379
2380
                $inputFilter->add($factory->createInput(array(
2381
                    'name'     => $attr['name'],
2382
                    'required' => $attr['required'],
2383
                    'allowEmpty' => !$attr['required'],
2384
                )));
2385
            }
2386
            if (isset($element->line_checkbox)) {
2387
                $attr = $this->getAttributes($element->line_checkbox[0]);
2388
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2386-2419 (lines=34) @@
2383
                    'allowEmpty' => !$attr['required'],
2384
                )));
2385
            }
2386
            if (isset($element->line_checkbox)) {
2387
                $attr = $this->getAttributes($element->line_checkbox[0]);
2388
                $element = new Element\MultiCheckbox($attr['name']);
2389
2390
                $element->setLabel($attr['label']);
2391
                $element->setAttributes(
2392
                    array(
2393
                        'name'      => $attr['name'],
2394
                        'required'  => $attr['required'],
2395
                        'allowEmpty'=> !$attr['required'],
2396
                        'class'     => $attr['class'],
2397
                        'id'        => $attr['id']
2398
                    )
2399
                );
2400
2401
                $values = array();
2402
                foreach ($attr['innerData'] as $value) {
2403
                    $values[] = $value->label;
2404
                }
2405
                $element->setValueOptions($values);
2406
                $form->add($element);
2407
2408
                $options = array();
2409
                $options['encoding'] = 'UTF-8';
2410
                $options['disable_inarray_validator'] = true;
2411
2412
                $element->setOptions($options);
2413
2414
                $inputFilter->add($factory->createInput(array(
2415
                    'name'      => $attr['name'],
2416
                    'required'  => $attr['required'],
2417
                    'allowEmpty'=> !$attr['required'],
2418
                )));
2419
            }
2420
            if (isset($element->line_dropdown)) {
2421
                $attr = $this->getAttributes($element->line_dropdown[0]);
2422
                $element = new Element\Select($attr['name']);
@@ 2420-2452 (lines=33) @@
2417
                    'allowEmpty'=> !$attr['required'],
2418
                )));
2419
            }
2420
            if (isset($element->line_dropdown)) {
2421
                $attr = $this->getAttributes($element->line_dropdown[0]);
2422
                $element = new Element\Select($attr['name']);
2423
2424
                $element->setLabel($attr['label']);
2425
                $element->setAttributes(
2426
                    array(
2427
                        'name'      => $attr['name'],
2428
                        'required'  => $attr['required'],
2429
                        'allowEmpty'=> !$attr['required'],
2430
                        'class'     => $attr['class'],
2431
                        'id'        => $attr['id']
2432
                    )
2433
                );
2434
                $values = array();
2435
                foreach ($attr['dropdownValues'] as $value) {
2436
                    $values[] = $value->dropdown_label;
2437
                }
2438
                $element->setValueOptions($values);
2439
                $form->add($element);
2440
2441
                $options = array();
2442
                $options['encoding'] = 'UTF-8';
2443
                $options['disable_inarray_validator'] = true;
2444
2445
                $element->setOptions($options);
2446
2447
                $inputFilter->add($factory->createInput(array(
2448
                    'name'     => $attr['name'],
2449
                    'required' => $attr['required'],
2450
                    'allowEmpty' => !$attr['required'],
2451
                )));
2452
            }
2453
            if (isset($element->line_paragraph)) {
2454
                $attr = $this->getAttributes($element->line_paragraph[0]);
2455
                $element = new Element\Textarea($attr['name']);