Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1969-2002 (lines=34) @@
1966
                $element = $this->decorate($element, $attr, $inputFilter);
1967
                $form->add($element);
1968
            }
1969
            if (isset($element->line_radio)) {
1970
                $attr = $this->getAttributes($element->line_radio[0]);
1971
                $element = new Element\Radio($attr['name']);
1972
1973
                $element->setLabel($attr['label']);
1974
                $element->setAttributes(
1975
                    array(
1976
                        'name'      => $attr['name'],
1977
                        'required'  => $attr['required'],
1978
                        'allowEmpty'=> !$attr['required'],
1979
                        'class'     => $attr['class'],
1980
                        'id'        => $attr['id']
1981
                    )
1982
                );
1983
                $values = array();
1984
                foreach ($attr['innerData'] as $value) {
1985
                    $values[] = $value->label;
1986
                }
1987
                $element->setValueOptions($values);
1988
        
1989
                $options = array();
1990
                $options['encoding'] = 'UTF-8';
1991
                $options['disable_inarray_validator'] = true;
1992
        
1993
                $element->setOptions($options);
1994
        
1995
                $form->add($element);
1996
        
1997
                $inputFilter->add($factory->createInput(array(
1998
                    'name'     => $attr['name'],
1999
                    'required' => $attr['required'],
2000
                    'allowEmpty' => !$attr['required'],
2001
                )));
2002
            }
2003
            if (isset($element->line_checkbox)) {
2004
                $attr = $this->getAttributes($element->line_checkbox[0]);
2005
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2003-2036 (lines=34) @@
2000
                    'allowEmpty' => !$attr['required'],
2001
                )));
2002
            }
2003
            if (isset($element->line_checkbox)) {
2004
                $attr = $this->getAttributes($element->line_checkbox[0]);
2005
                $element = new Element\MultiCheckbox($attr['name']);
2006
        
2007
                $element->setLabel($attr['label']);
2008
                $element->setAttributes(
2009
                    array(
2010
                        'name'      => $attr['name'],
2011
                        'required'  => $attr['required'],
2012
                        'allowEmpty'=> !$attr['required'],
2013
                        'class'     => $attr['class'],
2014
                        'id'        => $attr['id']
2015
                    )
2016
                );
2017
2018
                $values = array();
2019
                foreach ($attr['innerData'] as $value) {
2020
                    $values[] = $value->label;
2021
                }
2022
                $element->setValueOptions($values);
2023
                $form->add($element);
2024
        
2025
                $options = array();
2026
                $options['encoding'] = 'UTF-8';
2027
                $options['disable_inarray_validator'] = true;
2028
        
2029
                $element->setOptions($options);
2030
        
2031
                $inputFilter->add($factory->createInput(array(
2032
                    'name'      => $attr['name'],
2033
                    'required'  => $attr['required'],
2034
                    'allowEmpty'=> !$attr['required'],
2035
                )));
2036
            }
2037
            if (isset($element->line_dropdown)) {
2038
                $attr = $this->getAttributes($element->line_dropdown[0]);
2039
                $element = new Element\Select($attr['name']);
@@ 2037-2069 (lines=33) @@
2034
                    'allowEmpty'=> !$attr['required'],
2035
                )));
2036
            }
2037
            if (isset($element->line_dropdown)) {
2038
                $attr = $this->getAttributes($element->line_dropdown[0]);
2039
                $element = new Element\Select($attr['name']);
2040
2041
                $element->setLabel($attr['label']);
2042
                $element->setAttributes(
2043
                    array(
2044
                        'name'      => $attr['name'],
2045
                        'required'  => $attr['required'],
2046
                        'allowEmpty'=> !$attr['required'],
2047
                        'class'     => $attr['class'],
2048
                        'id'        => $attr['id']
2049
                    )
2050
                );
2051
                $values = array();
2052
                foreach ($attr['dropdownValues'] as $value) {
2053
                    $values[] = $value->dropdown_label;
2054
                }
2055
                $element->setValueOptions($values);
2056
                $form->add($element);
2057
        
2058
                $options = array();
2059
                $options['encoding'] = 'UTF-8';
2060
                $options['disable_inarray_validator'] = true;
2061
        
2062
                $element->setOptions($options);
2063
        
2064
                $inputFilter->add($factory->createInput(array(
2065
                    'name'     => $attr['name'],
2066
                    'required' => $attr['required'],
2067
                    'allowEmpty' => !$attr['required'],
2068
                )));
2069
            }
2070
            if (isset($element->line_paragraph)) {
2071
                $attr = $this->getAttributes($element->line_paragraph[0]);
2072
                $element = new Element\Textarea($attr['name']);