Code Duplication    Length = 5-11 lines in 3 locations

src/Http/Api/IssueController.php 3 locations

@@ 2189-2199 (lines=11) @@
2186
                        $issue['parent'] = $value['parent'];
2187
                    }
2188
2189
                    if (isset($value['priority']) && $value['priority']) {
2190
                        if (!isset($priorities[$value['priority']]) || !$priorities[$value['priority']]) {
2191
                            $err_msgs[$cur_title][] = '优先级列值匹配失败。';
2192
                        }
2193
                        else
2194
                        {
2195
                            $issue['priority'] = $priorities[$value['priority']];
2196
                        }
2197
                    }
2198
2199
                    if (isset($value['state']) && $value['state']) {
2200
                        if (!isset($states[$value['state']]) || !$states[$value['state']]) {
2201
                            $err_msgs[$cur_title][] = '状态列值匹配失败。';
2202
                        }
@@ 2213-2223 (lines=11) @@
2210
                        }
2211
                    }
2212
2213
                    if (isset($value['resolution']) && $value['resolution']) {
2214
                        if (!isset($resolutions[$value['resolution']]) || !$resolutions[$value['resolution']]) {
2215
                            $err_msgs[$cur_title][] = '解决结果列值匹配失败。';
2216
                        }
2217
                        else
2218
                        {
2219
                            $issue['resolution'] = $resolutions[$value['resolution']];
2220
                        }
2221
                    }
2222
2223
                    $user_relate_fields = [ 'assignee' => '经办人', 'reporter' => '报告者', 'resolver' => '解决者', 'closer' => '关闭时间' ];
2224
                    foreach ($user_relate_fields as $uk => $uv)
2225
                    {
2226
                        if (isset($value[$uk]) && $value[$uk]) {
@@ 2259-2263 (lines=5) @@
2256
                    $schema = $types[$value['type']]['schema'];
2257
                    foreach ($schema as $field)
2258
                    {
2259
                        if (isset($field['required']) && $field['required'] && (!isset($value[$field['key']]) || !$value[$field['key']])) {
2260
                            $err_msgs[$cur_title][] = $fields[$field['key']] . '列值不能为空。';
2261
                            continue;
2262
                        }
2263
2264
                        if (isset($value[$field['key']]) && $value[$field['key']]) {
2265
                            $field_key = $field['key'];
2266
                            $field_value = $value[$field['key']];