Code Duplication    Length = 9-9 lines in 2 locations

api/v1/class.ShiftAPI.php 2 locations

@@ 94-102 (lines=9) @@
91
            return true;
92
        }
93
        $shift = new \VolunteerShift(false, $entry[0]);
94
        if($shift->isFilled())
95
        {
96
            $email = new \Emails\ShiftEmail($shift, 'shiftCanceledSource');
97
            $emailProvider = \EmailProvider::getInstance();
98
            if($emailProvider->sendEmail($email) === false)
99
            {
100
                throw new \Exception('Unable to send email!');
101
            } 
102
        }
103
        return true;
104
    }
105
@@ 526-534 (lines=9) @@
523
        $entity['participant'] = '';
524
        $entity['status'] = 'unfilled';
525
        $ret = $dataTable->update($filter, $entity);
526
        if($ret)
527
        {
528
            $email = new \Emails\ShiftEmail($shift, 'shiftEmptiedSource');
529
            $emailProvider = \EmailProvider::getInstance();
530
            if($emailProvider->sendEmail($email) === false)
531
            {
532
                throw new \Exception('Unable to send email!');
533
            }
534
        }
535
        return $response->withJSON($ret);
536
    }
537