Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

@@ 2089-2122 (lines=34) @@
2086
                $element = $this->decorate($element, $attr, $inputFilter);
2087
                $form->add($element);
2088
            }
2089
            if (isset($element->line_radio)) {
2090
                $attr = $this->getAttributes($element->line_radio[0]);
2091
                $element = new Element\Radio($attr['name']);
2092
2093
                $element->setLabel($attr['label']);
2094
                $element->setAttributes(
2095
                    array(
2096
                        'name'      => $attr['name'],
2097
                        'required'  => $attr['required'],
2098
                        'allowEmpty'=> !$attr['required'],
2099
                        'class'     => $attr['class'],
2100
                        'id'        => $attr['id']
2101
                    )
2102
                );
2103
                $values = array();
2104
                foreach ($attr['innerData'] as $value) {
2105
                    $values[] = $value->label;
2106
                }
2107
                $element->setValueOptions($values);
2108
        
2109
                $options = array();
2110
                $options['encoding'] = 'UTF-8';
2111
                $options['disable_inarray_validator'] = true;
2112
        
2113
                $element->setOptions($options);
2114
        
2115
                $form->add($element);
2116
        
2117
                $inputFilter->add($factory->createInput(array(
2118
                    'name'     => $attr['name'],
2119
                    'required' => $attr['required'],
2120
                    'allowEmpty' => !$attr['required'],
2121
                )));
2122
            }
2123
            if (isset($element->line_checkbox)) {
2124
                $attr = $this->getAttributes($element->line_checkbox[0]);
2125
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2123-2156 (lines=34) @@
2120
                    'allowEmpty' => !$attr['required'],
2121
                )));
2122
            }
2123
            if (isset($element->line_checkbox)) {
2124
                $attr = $this->getAttributes($element->line_checkbox[0]);
2125
                $element = new Element\MultiCheckbox($attr['name']);
2126
        
2127
                $element->setLabel($attr['label']);
2128
                $element->setAttributes(
2129
                    array(
2130
                        'name'      => $attr['name'],
2131
                        'required'  => $attr['required'],
2132
                        'allowEmpty'=> !$attr['required'],
2133
                        'class'     => $attr['class'],
2134
                        'id'        => $attr['id']
2135
                    )
2136
                );
2137
2138
                $values = array();
2139
                foreach ($attr['innerData'] as $value) {
2140
                    $values[] = $value->label;
2141
                }
2142
                $element->setValueOptions($values);
2143
                $form->add($element);
2144
        
2145
                $options = array();
2146
                $options['encoding'] = 'UTF-8';
2147
                $options['disable_inarray_validator'] = true;
2148
        
2149
                $element->setOptions($options);
2150
        
2151
                $inputFilter->add($factory->createInput(array(
2152
                    'name'      => $attr['name'],
2153
                    'required'  => $attr['required'],
2154
                    'allowEmpty'=> !$attr['required'],
2155
                )));
2156
            }
2157
            if (isset($element->line_dropdown)) {
2158
                $attr = $this->getAttributes($element->line_dropdown[0]);
2159
                $element = new Element\Select($attr['name']);
@@ 2157-2189 (lines=33) @@
2154
                    'allowEmpty'=> !$attr['required'],
2155
                )));
2156
            }
2157
            if (isset($element->line_dropdown)) {
2158
                $attr = $this->getAttributes($element->line_dropdown[0]);
2159
                $element = new Element\Select($attr['name']);
2160
2161
                $element->setLabel($attr['label']);
2162
                $element->setAttributes(
2163
                    array(
2164
                        'name'      => $attr['name'],
2165
                        'required'  => $attr['required'],
2166
                        'allowEmpty'=> !$attr['required'],
2167
                        'class'     => $attr['class'],
2168
                        'id'        => $attr['id']
2169
                    )
2170
                );
2171
                $values = array();
2172
                foreach ($attr['dropdownValues'] as $value) {
2173
                    $values[] = $value->dropdown_label;
2174
                }
2175
                $element->setValueOptions($values);
2176
                $form->add($element);
2177
        
2178
                $options = array();
2179
                $options['encoding'] = 'UTF-8';
2180
                $options['disable_inarray_validator'] = true;
2181
        
2182
                $element->setOptions($options);
2183
        
2184
                $inputFilter->add($factory->createInput(array(
2185
                    'name'     => $attr['name'],
2186
                    'required' => $attr['required'],
2187
                    'allowEmpty' => !$attr['required'],
2188
                )));
2189
            }
2190
            if (isset($element->line_paragraph)) {
2191
                $attr = $this->getAttributes($element->line_paragraph[0]);
2192
                $element = new Element\Textarea($attr['name']);