Code Duplication    Length = 9-9 lines in 2 locations

api/v1/class.ShiftAPI.php 2 locations

@@ 72-80 (lines=9) @@
69
            return true;
70
        }
71
        $shift = new \VolunteerShift(false, $entry[0]);
72
        if($shift->isFilled())
73
        {
74
            $email = new \Emails\ShiftEmail($shift, 'shiftCanceledSource');
75
            $emailProvider = \EmailProvider::getInstance();
76
            if($emailProvider->sendEmail($email) === false)
77
            {
78
                throw new \Exception('Unable to send email!');
79
            } 
80
        }
81
        return true;
82
    }
83
@@ 490-498 (lines=9) @@
487
        $entity['participant'] = '';
488
        $entity['status'] = 'unfilled';
489
        $ret = $dataTable->update($filter, $entity);
490
        if($ret)
491
        {
492
            $email = new \Emails\ShiftEmail($shift, 'shiftEmptiedSource');
493
            $emailProvider = \EmailProvider::getInstance();
494
            if($emailProvider->sendEmail($email) === false)
495
            {
496
                throw new \Exception('Unable to send email!');
497
            }
498
        }
499
        return $response->withJSON($ret);
500
    }
501