Code Duplication    Length = 9-9 lines in 2 locations

api/v1/class.ShiftAPI.php 2 locations

@@ 87-95 (lines=9) @@
84
            return true;
85
        }
86
        $shift = new \VolunteerShift(false, $entry[0]);
87
        if($shift->isFilled())
88
        {
89
            $email = new \Emails\ShiftEmail($shift, 'shiftCanceledSource');
90
            $emailProvider = \EmailProvider::getInstance();
91
            if($emailProvider->sendEmail($email) === false)
92
            {
93
                throw new \Exception('Unable to send email!');
94
            } 
95
        }
96
        return true;
97
    }
98
@@ 519-527 (lines=9) @@
516
        $entity['participant'] = '';
517
        $entity['status'] = 'unfilled';
518
        $ret = $dataTable->update($filter, $entity);
519
        if($ret)
520
        {
521
            $email = new \Emails\ShiftEmail($shift, 'shiftEmptiedSource');
522
            $emailProvider = \EmailProvider::getInstance();
523
            if($emailProvider->sendEmail($email) === false)
524
            {
525
                throw new \Exception('Unable to send email!');
526
            }
527
        }
528
        return $response->withJSON($ret);
529
    }
530