Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

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