Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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