Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

@@ 1797-1830 (lines=34) @@
1794
                $element = $this->decorate($element, $attr, $inputFilter);
1795
                $form->add($element);
1796
            }
1797
            if (isset($element->line_radio)) {
1798
                $attr = $this->getAttributes($element->line_radio[0]);
1799
                $element = new Element\Radio($attr['name']);
1800
1801
                $element->setLabel($attr['label']);
1802
                $element->setAttributes(
1803
                    array(
1804
                        'name'      => $attr['name'],
1805
                        'required'  => $attr['required'],
1806
                        'allowEmpty'=> !$attr['required'],
1807
                        'class'     => $attr['class'],
1808
                        'id'        => $attr['id']
1809
                    )
1810
                );
1811
                $values = array();
1812
                foreach ($attr['innerData'] as $value) {
1813
                    $values[] = $value->label;
1814
                }
1815
                $element->setValueOptions($values);
1816
        
1817
                $options = array();
1818
                $options['encoding'] = 'UTF-8';
1819
                $options['disable_inarray_validator'] = true;
1820
        
1821
                $element->setOptions($options);
1822
        
1823
                $form->add($element);
1824
        
1825
                $inputFilter->add($factory->createInput(array(
1826
                    'name'     => $attr['name'],
1827
                    'required' => $attr['required'],
1828
                    'allowEmpty' => !$attr['required'],
1829
                )));
1830
            }
1831
            if (isset($element->line_checkbox)) {
1832
                $attr = $this->getAttributes($element->line_checkbox[0]);
1833
                $element = new Element\MultiCheckbox($attr['name']);
@@ 1831-1864 (lines=34) @@
1828
                    'allowEmpty' => !$attr['required'],
1829
                )));
1830
            }
1831
            if (isset($element->line_checkbox)) {
1832
                $attr = $this->getAttributes($element->line_checkbox[0]);
1833
                $element = new Element\MultiCheckbox($attr['name']);
1834
        
1835
                $element->setLabel($attr['label']);
1836
                $element->setAttributes(
1837
                    array(
1838
                        'name'      => $attr['name'],
1839
                        'required'  => $attr['required'],
1840
                        'allowEmpty'=> !$attr['required'],
1841
                        'class'     => $attr['class'],
1842
                        'id'        => $attr['id']
1843
                    )
1844
                );
1845
1846
                $values = array();
1847
                foreach ($attr['innerData'] as $value) {
1848
                    $values[] = $value->label;
1849
                }
1850
                $element->setValueOptions($values);
1851
                $form->add($element);
1852
        
1853
                $options = array();
1854
                $options['encoding'] = 'UTF-8';
1855
                $options['disable_inarray_validator'] = true;
1856
        
1857
                $element->setOptions($options);
1858
        
1859
                $inputFilter->add($factory->createInput(array(
1860
                    'name'      => $attr['name'],
1861
                    'required'  => $attr['required'],
1862
                    'allowEmpty'=> !$attr['required'],
1863
                )));
1864
            }
1865
            if (isset($element->line_dropdown)) {
1866
                $attr = $this->getAttributes($element->line_dropdown[0]);
1867
                $element = new Element\Select($attr['name']);
@@ 1865-1897 (lines=33) @@
1862
                    'allowEmpty'=> !$attr['required'],
1863
                )));
1864
            }
1865
            if (isset($element->line_dropdown)) {
1866
                $attr = $this->getAttributes($element->line_dropdown[0]);
1867
                $element = new Element\Select($attr['name']);
1868
1869
                $element->setLabel($attr['label']);
1870
                $element->setAttributes(
1871
                    array(
1872
                        'name'      => $attr['name'],
1873
                        'required'  => $attr['required'],
1874
                        'allowEmpty'=> !$attr['required'],
1875
                        'class'     => $attr['class'],
1876
                        'id'        => $attr['id']
1877
                    )
1878
                );
1879
                $values = array();
1880
                foreach ($attr['dropdownValues'] as $value) {
1881
                    $values[] = $value->dropdown_label;
1882
                }
1883
                $element->setValueOptions($values);
1884
                $form->add($element);
1885
        
1886
                $options = array();
1887
                $options['encoding'] = 'UTF-8';
1888
                $options['disable_inarray_validator'] = true;
1889
        
1890
                $element->setOptions($options);
1891
        
1892
                $inputFilter->add($factory->createInput(array(
1893
                    'name'     => $attr['name'],
1894
                    'required' => $attr['required'],
1895
                    'allowEmpty' => !$attr['required'],
1896
                )));
1897
            }
1898
            if (isset($element->line_paragraph)) {
1899
                $attr = $this->getAttributes($element->line_paragraph[0]);
1900
                $element = new Element\Textarea($attr['name']);