Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 192-195 (lines=4) @@
189
            return $response->withStatus(404);
190
        }
191
        $entity = $entity[0];
192
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
193
        {
194
            return $response->withStatus(401);
195
        }
196
        $shift = new \VolunteerShift($shiftId, $entity);
197
        $entity = $this->processShift($entity, $request);
198
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 328-331 (lines=4) @@
325
            return $response->withStatus(404);
326
        }
327
        $entity = $entity[0];
328
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
329
        {
330
            return $response->withStatus(401);
331
        }
332
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
333
        $entities = $dataTable->read($filter);
334
        $count = count($entities);
@@ 375-378 (lines=4) @@
372
            return $response->withStatus(404);
373
        }
374
        $entity = $entity[0];
375
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
376
        {
377
            return $response->withStatus(401);
378
        }
379
        $data = $request->getParsedBody();
380
        $myShift = $data['myshift'];
381
        $roles = array();