Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

@@ 1817-1850 (lines=34) @@
1814
                $element = $this->decorate($element, $attr, $inputFilter);
1815
                $form->add($element);
1816
            }
1817
            if (isset($element->line_radio)) {
1818
                $attr = $this->getAttributes($element->line_radio[0]);
1819
                $element = new Element\Radio($attr['name']);
1820
1821
                $element->setLabel($attr['label']);
1822
                $element->setAttributes(
1823
                    array(
1824
                        'name'      => $attr['name'],
1825
                        'required'  => $attr['required'],
1826
                        'allowEmpty'=> !$attr['required'],
1827
                        'class'     => $attr['class'],
1828
                        'id'        => $attr['id']
1829
                    )
1830
                );
1831
                $values = array();
1832
                foreach ($attr['innerData'] as $value) {
1833
                    $values[] = $value->label;
1834
                }
1835
                $element->setValueOptions($values);
1836
        
1837
                $options = array();
1838
                $options['encoding'] = 'UTF-8';
1839
                $options['disable_inarray_validator'] = true;
1840
        
1841
                $element->setOptions($options);
1842
        
1843
                $form->add($element);
1844
        
1845
                $inputFilter->add($factory->createInput(array(
1846
                    'name'     => $attr['name'],
1847
                    'required' => $attr['required'],
1848
                    'allowEmpty' => !$attr['required'],
1849
                )));
1850
            }
1851
            if (isset($element->line_checkbox)) {
1852
                $attr = $this->getAttributes($element->line_checkbox[0]);
1853
                $element = new Element\MultiCheckbox($attr['name']);
@@ 1851-1884 (lines=34) @@
1848
                    'allowEmpty' => !$attr['required'],
1849
                )));
1850
            }
1851
            if (isset($element->line_checkbox)) {
1852
                $attr = $this->getAttributes($element->line_checkbox[0]);
1853
                $element = new Element\MultiCheckbox($attr['name']);
1854
        
1855
                $element->setLabel($attr['label']);
1856
                $element->setAttributes(
1857
                    array(
1858
                        'name'      => $attr['name'],
1859
                        'required'  => $attr['required'],
1860
                        'allowEmpty'=> !$attr['required'],
1861
                        'class'     => $attr['class'],
1862
                        'id'        => $attr['id']
1863
                    )
1864
                );
1865
1866
                $values = array();
1867
                foreach ($attr['innerData'] as $value) {
1868
                    $values[] = $value->label;
1869
                }
1870
                $element->setValueOptions($values);
1871
                $form->add($element);
1872
        
1873
                $options = array();
1874
                $options['encoding'] = 'UTF-8';
1875
                $options['disable_inarray_validator'] = true;
1876
        
1877
                $element->setOptions($options);
1878
        
1879
                $inputFilter->add($factory->createInput(array(
1880
                    'name'      => $attr['name'],
1881
                    'required'  => $attr['required'],
1882
                    'allowEmpty'=> !$attr['required'],
1883
                )));
1884
            }
1885
            if (isset($element->line_dropdown)) {
1886
                $attr = $this->getAttributes($element->line_dropdown[0]);
1887
                $element = new Element\Select($attr['name']);
@@ 1885-1917 (lines=33) @@
1882
                    'allowEmpty'=> !$attr['required'],
1883
                )));
1884
            }
1885
            if (isset($element->line_dropdown)) {
1886
                $attr = $this->getAttributes($element->line_dropdown[0]);
1887
                $element = new Element\Select($attr['name']);
1888
1889
                $element->setLabel($attr['label']);
1890
                $element->setAttributes(
1891
                    array(
1892
                        'name'      => $attr['name'],
1893
                        'required'  => $attr['required'],
1894
                        'allowEmpty'=> !$attr['required'],
1895
                        'class'     => $attr['class'],
1896
                        'id'        => $attr['id']
1897
                    )
1898
                );
1899
                $values = array();
1900
                foreach ($attr['dropdownValues'] as $value) {
1901
                    $values[] = $value->dropdown_label;
1902
                }
1903
                $element->setValueOptions($values);
1904
                $form->add($element);
1905
        
1906
                $options = array();
1907
                $options['encoding'] = 'UTF-8';
1908
                $options['disable_inarray_validator'] = true;
1909
        
1910
                $element->setOptions($options);
1911
        
1912
                $inputFilter->add($factory->createInput(array(
1913
                    'name'     => $attr['name'],
1914
                    'required' => $attr['required'],
1915
                    'allowEmpty' => !$attr['required'],
1916
                )));
1917
            }
1918
            if (isset($element->line_paragraph)) {
1919
                $attr = $this->getAttributes($element->line_paragraph[0]);
1920
                $element = new Element\Textarea($attr['name']);