Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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