Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1941-1974 (lines=34) @@
1938
                $element = $this->decorate($element, $attr, $inputFilter);
1939
                $form->add($element);
1940
            }
1941
            if (isset($element->line_radio)) {
1942
                $attr = $this->getAttributes($element->line_radio[0]);
1943
                $element = new Element\Radio($attr['name']);
1944
1945
                $element->setLabel($attr['label']);
1946
                $element->setAttributes(
1947
                    array(
1948
                        'name'      => $attr['name'],
1949
                        'required'  => $attr['required'],
1950
                        'allowEmpty'=> !$attr['required'],
1951
                        'class'     => $attr['class'],
1952
                        'id'        => $attr['id']
1953
                    )
1954
                );
1955
                $values = array();
1956
                foreach ($attr['innerData'] as $value) {
1957
                    $values[] = $value->label;
1958
                }
1959
                $element->setValueOptions($values);
1960
        
1961
                $options = array();
1962
                $options['encoding'] = 'UTF-8';
1963
                $options['disable_inarray_validator'] = true;
1964
        
1965
                $element->setOptions($options);
1966
        
1967
                $form->add($element);
1968
        
1969
                $inputFilter->add($factory->createInput(array(
1970
                    'name'     => $attr['name'],
1971
                    'required' => $attr['required'],
1972
                    'allowEmpty' => !$attr['required'],
1973
                )));
1974
            }
1975
            if (isset($element->line_checkbox)) {
1976
                $attr = $this->getAttributes($element->line_checkbox[0]);
1977
                $element = new Element\MultiCheckbox($attr['name']);
@@ 1975-2008 (lines=34) @@
1972
                    'allowEmpty' => !$attr['required'],
1973
                )));
1974
            }
1975
            if (isset($element->line_checkbox)) {
1976
                $attr = $this->getAttributes($element->line_checkbox[0]);
1977
                $element = new Element\MultiCheckbox($attr['name']);
1978
        
1979
                $element->setLabel($attr['label']);
1980
                $element->setAttributes(
1981
                    array(
1982
                        'name'      => $attr['name'],
1983
                        'required'  => $attr['required'],
1984
                        'allowEmpty'=> !$attr['required'],
1985
                        'class'     => $attr['class'],
1986
                        'id'        => $attr['id']
1987
                    )
1988
                );
1989
1990
                $values = array();
1991
                foreach ($attr['innerData'] as $value) {
1992
                    $values[] = $value->label;
1993
                }
1994
                $element->setValueOptions($values);
1995
                $form->add($element);
1996
        
1997
                $options = array();
1998
                $options['encoding'] = 'UTF-8';
1999
                $options['disable_inarray_validator'] = true;
2000
        
2001
                $element->setOptions($options);
2002
        
2003
                $inputFilter->add($factory->createInput(array(
2004
                    'name'      => $attr['name'],
2005
                    'required'  => $attr['required'],
2006
                    'allowEmpty'=> !$attr['required'],
2007
                )));
2008
            }
2009
            if (isset($element->line_dropdown)) {
2010
                $attr = $this->getAttributes($element->line_dropdown[0]);
2011
                $element = new Element\Select($attr['name']);
@@ 2009-2041 (lines=33) @@
2006
                    'allowEmpty'=> !$attr['required'],
2007
                )));
2008
            }
2009
            if (isset($element->line_dropdown)) {
2010
                $attr = $this->getAttributes($element->line_dropdown[0]);
2011
                $element = new Element\Select($attr['name']);
2012
2013
                $element->setLabel($attr['label']);
2014
                $element->setAttributes(
2015
                    array(
2016
                        'name'      => $attr['name'],
2017
                        'required'  => $attr['required'],
2018
                        'allowEmpty'=> !$attr['required'],
2019
                        'class'     => $attr['class'],
2020
                        'id'        => $attr['id']
2021
                    )
2022
                );
2023
                $values = array();
2024
                foreach ($attr['dropdownValues'] as $value) {
2025
                    $values[] = $value->dropdown_label;
2026
                }
2027
                $element->setValueOptions($values);
2028
                $form->add($element);
2029
        
2030
                $options = array();
2031
                $options['encoding'] = 'UTF-8';
2032
                $options['disable_inarray_validator'] = true;
2033
        
2034
                $element->setOptions($options);
2035
        
2036
                $inputFilter->add($factory->createInput(array(
2037
                    'name'     => $attr['name'],
2038
                    'required' => $attr['required'],
2039
                    'allowEmpty' => !$attr['required'],
2040
                )));
2041
            }
2042
            if (isset($element->line_paragraph)) {
2043
                $attr = $this->getAttributes($element->line_paragraph[0]);
2044
                $element = new Element\Textarea($attr['name']);