Code Duplication    Length = 33-34 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

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