Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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