Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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