Code Duplication    Length = 33-34 lines in 3 locations

src/Service/Game.php 3 locations

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