Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 2010-2043 (lines=34) @@
2007
                $element = $this->decorate($element, $attr, $inputFilter);
2008
                $form->add($element);
2009
            }
2010
            if (isset($element->line_radio)) {
2011
                $attr = $this->getAttributes($element->line_radio[0]);
2012
                $element = new Element\Radio($attr['name']);
2013
2014
                $element->setLabel($attr['label']);
2015
                $element->setAttributes(
2016
                    array(
2017
                        'name'      => $attr['name'],
2018
                        'required'  => $attr['required'],
2019
                        'allowEmpty'=> !$attr['required'],
2020
                        'class'     => $attr['class'],
2021
                        'id'        => $attr['id']
2022
                    )
2023
                );
2024
                $values = array();
2025
                foreach ($attr['innerData'] as $value) {
2026
                    $values[] = $value->label;
2027
                }
2028
                $element->setValueOptions($values);
2029
        
2030
                $options = array();
2031
                $options['encoding'] = 'UTF-8';
2032
                $options['disable_inarray_validator'] = true;
2033
        
2034
                $element->setOptions($options);
2035
        
2036
                $form->add($element);
2037
        
2038
                $inputFilter->add($factory->createInput(array(
2039
                    'name'     => $attr['name'],
2040
                    'required' => $attr['required'],
2041
                    'allowEmpty' => !$attr['required'],
2042
                )));
2043
            }
2044
            if (isset($element->line_checkbox)) {
2045
                $attr = $this->getAttributes($element->line_checkbox[0]);
2046
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2044-2077 (lines=34) @@
2041
                    'allowEmpty' => !$attr['required'],
2042
                )));
2043
            }
2044
            if (isset($element->line_checkbox)) {
2045
                $attr = $this->getAttributes($element->line_checkbox[0]);
2046
                $element = new Element\MultiCheckbox($attr['name']);
2047
        
2048
                $element->setLabel($attr['label']);
2049
                $element->setAttributes(
2050
                    array(
2051
                        'name'      => $attr['name'],
2052
                        'required'  => $attr['required'],
2053
                        'allowEmpty'=> !$attr['required'],
2054
                        'class'     => $attr['class'],
2055
                        'id'        => $attr['id']
2056
                    )
2057
                );
2058
2059
                $values = array();
2060
                foreach ($attr['innerData'] as $value) {
2061
                    $values[] = $value->label;
2062
                }
2063
                $element->setValueOptions($values);
2064
                $form->add($element);
2065
        
2066
                $options = array();
2067
                $options['encoding'] = 'UTF-8';
2068
                $options['disable_inarray_validator'] = true;
2069
        
2070
                $element->setOptions($options);
2071
        
2072
                $inputFilter->add($factory->createInput(array(
2073
                    'name'      => $attr['name'],
2074
                    'required'  => $attr['required'],
2075
                    'allowEmpty'=> !$attr['required'],
2076
                )));
2077
            }
2078
            if (isset($element->line_dropdown)) {
2079
                $attr = $this->getAttributes($element->line_dropdown[0]);
2080
                $element = new Element\Select($attr['name']);
@@ 2078-2110 (lines=33) @@
2075
                    'allowEmpty'=> !$attr['required'],
2076
                )));
2077
            }
2078
            if (isset($element->line_dropdown)) {
2079
                $attr = $this->getAttributes($element->line_dropdown[0]);
2080
                $element = new Element\Select($attr['name']);
2081
2082
                $element->setLabel($attr['label']);
2083
                $element->setAttributes(
2084
                    array(
2085
                        'name'      => $attr['name'],
2086
                        'required'  => $attr['required'],
2087
                        'allowEmpty'=> !$attr['required'],
2088
                        'class'     => $attr['class'],
2089
                        'id'        => $attr['id']
2090
                    )
2091
                );
2092
                $values = array();
2093
                foreach ($attr['dropdownValues'] as $value) {
2094
                    $values[] = $value->dropdown_label;
2095
                }
2096
                $element->setValueOptions($values);
2097
                $form->add($element);
2098
        
2099
                $options = array();
2100
                $options['encoding'] = 'UTF-8';
2101
                $options['disable_inarray_validator'] = true;
2102
        
2103
                $element->setOptions($options);
2104
        
2105
                $inputFilter->add($factory->createInput(array(
2106
                    'name'     => $attr['name'],
2107
                    'required' => $attr['required'],
2108
                    'allowEmpty' => !$attr['required'],
2109
                )));
2110
            }
2111
            if (isset($element->line_paragraph)) {
2112
                $attr = $this->getAttributes($element->line_paragraph[0]);
2113
                $element = new Element\Textarea($attr['name']);