Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

@@ 2122-2155 (lines=34) @@
2119
                $element = $this->decorate($element, $attr, $inputFilter);
2120
                $form->add($element);
2121
            }
2122
            if (isset($element->line_radio)) {
2123
                $attr = $this->getAttributes($element->line_radio[0]);
2124
                $element = new Element\Radio($attr['name']);
2125
2126
                $element->setLabel($attr['label']);
2127
                $element->setAttributes(
2128
                    array(
2129
                        'name'      => $attr['name'],
2130
                        'required'  => $attr['required'],
2131
                        'allowEmpty'=> !$attr['required'],
2132
                        'class'     => $attr['class'],
2133
                        'id'        => $attr['id']
2134
                    )
2135
                );
2136
                $values = array();
2137
                foreach ($innerData as $value) {
2138
                    $values[] = $value->label;
2139
                }
2140
                $element->setValueOptions($values);
2141
        
2142
                $options = array();
2143
                $options['encoding'] = 'UTF-8';
2144
                $options['disable_inarray_validator'] = true;
2145
        
2146
                $element->setOptions($options);
2147
        
2148
                $form->add($element);
2149
        
2150
                $inputFilter->add($factory->createInput(array(
2151
                    'name'     => $attr['name'],
2152
                    'required' => $attr['required'],
2153
                    'allowEmpty' => !$attr['required'],
2154
                )));
2155
            }
2156
            if (isset($element->line_checkbox)) {
2157
                $attr = $this->getAttributes($element->line_checkbox[0]);
2158
                $element = new Element\MultiCheckbox($attr['name']);
@@ 2156-2189 (lines=34) @@
2153
                    'allowEmpty' => !$attr['required'],
2154
                )));
2155
            }
2156
            if (isset($element->line_checkbox)) {
2157
                $attr = $this->getAttributes($element->line_checkbox[0]);
2158
                $element = new Element\MultiCheckbox($attr['name']);
2159
        
2160
                $element->setLabel($attr['label']);
2161
                $element->setAttributes(
2162
                    array(
2163
                        'name'      => $attr['name'],
2164
                        'required'  => $attr['required'],
2165
                        'allowEmpty'=> !$attr['required'],
2166
                        'class'     => $attr['class'],
2167
                        'id'        => $attr['id']
2168
                    )
2169
                );
2170
2171
                $values = array();
2172
                foreach ($attr['innerData'] as $value) {
2173
                    $values[] = $value->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_dropdown)) {
2191
                $attr = $this->getAttributes($element->line_dropdown[0]);
2192
                $element = new Element\Select($attr['name']);
@@ 2190-2222 (lines=33) @@
2187
                    'allowEmpty'=> !$attr['required'],
2188
                )));
2189
            }
2190
            if (isset($element->line_dropdown)) {
2191
                $attr = $this->getAttributes($element->line_dropdown[0]);
2192
                $element = new Element\Select($attr['name']);
2193
2194
                $element->setLabel($attr['label']);
2195
                $element->setAttributes(
2196
                    array(
2197
                        'name'      => $attr['name'],
2198
                        'required'  => $attr['required'],
2199
                        'allowEmpty'=> !$attr['required'],
2200
                        'class'     => $attr['class'],
2201
                        'id'        => $attr['id']
2202
                    )
2203
                );
2204
                $values = array();
2205
                foreach ($attr['dropdownValues'] as $value) {
2206
                    $values[] = $value->dropdown_label;
2207
                }
2208
                $element->setValueOptions($values);
2209
                $form->add($element);
2210
        
2211
                $options = array();
2212
                $options['encoding'] = 'UTF-8';
2213
                $options['disable_inarray_validator'] = true;
2214
        
2215
                $element->setOptions($options);
2216
        
2217
                $inputFilter->add($factory->createInput(array(
2218
                    'name'     => $attr['name'],
2219
                    'required' => $attr['required'],
2220
                    'allowEmpty' => !$attr['required'],
2221
                )));
2222
            }
2223
            if (isset($element->line_paragraph)) {
2224
                $attr = $this->getAttributes($element->line_paragraph[0]);
2225
                $element = new Element\Textarea($attr['name']);