Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

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