Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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