Code Duplication    Length = 21-21 lines in 2 locations

src/Http/Api/IssueController.php 2 locations

@@ 1368-1388 (lines=21) @@
1365
        $updValues = [];
1366
1367
        $assignee_id = $request->input('assignee');
1368
        if (isset($assignee_id)) {
1369
            if ($assignee_id) {
1370
                if (!$this->isPermissionAllowed($project_key, 'assigned_issue', $assignee_id)) {
1371
                    return response()->json(['ecode' => -11118, 'emsg' => 'the assigned user has not assigned-issue permission.']);
1372
                }
1373
1374
                $user_info = Sentinel::findById($assignee_id);
1375
                if ($user_info) {
1376
                    $assignee = [ 'id' => $assignee_id, 'name' => $user_info->first_name, 'email' => $user_info->email ];
1377
                    $updValues['assignee'] = $assignee;
1378
                }
1379
            }
1380
            else
1381
            {
1382
                throw new \UnexpectedValueException('the issue assignee cannot be empty.', -11104);
1383
            }
1384
        }
1385
1386
        $resolution = $request->input('resolution');
1387
        if (isset($resolution) && $resolution) {
1388
            $updValues['resolution'] = $resolution;
1389
        }
1390
1391
        $issue = DB::collection('issue_' . $project_key)->where('_id', $id)->first();
@@ 1451-1471 (lines=21) @@
1448
        $insValues['reporter'] = [ 'id' => $this->user->id, 'name' => $this->user->first_name, 'email' => $this->user->email ];
1449
1450
        $assignee_id = $request->input('assignee');
1451
        if (isset($assignee_id)) {
1452
            if ($assignee_id) {
1453
                if (!$this->isPermissionAllowed($project_key, 'assigned_issue', $assignee_id)) {
1454
                    return response()->json(['ecode' => -11118, 'emsg' => 'the assigned user has not assigned-issue permission.']);
1455
                }
1456
1457
                $user_info = Sentinel::findById($assignee_id);
1458
                if ($user_info) {
1459
                    $assignee = [ 'id' => $assignee_id, 'name' => $user_info->first_name, 'email' => $user_info->email ];
1460
                    $insValues['assignee'] = $assignee;
1461
                }
1462
            }
1463
            else
1464
            {
1465
                throw new \UnexpectedValueException('the issue assignee cannot be empty.', -11104);
1466
            }
1467
        }
1468
1469
        $resolution = $request->input('resolution');
1470
        if (isset($resolution) && $resolution) {
1471
            $insValues['resolution'] = $resolution;
1472
        }
1473
1474
        $table = 'issue_' . $project_key;