Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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