Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 236-239 (lines=4) @@
233
            return $response->withStatus(404);
234
        }
235
        $entity = $entity[0];
236
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
237
        {
238
            return $response->withStatus(401);
239
        }
240
        $shift = new \VolunteerShift($shiftId, $entity);
241
        $entity = $this->processShift($entity, $request);
242
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 372-375 (lines=4) @@
369
            return $response->withStatus(404);
370
        }
371
        $entity = $entity[0];
372
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
373
        {
374
            return $response->withStatus(401);
375
        }
376
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
377
        $entities = $dataTable->read($filter);
378
        $count = count($entities);
@@ 419-422 (lines=4) @@
416
            return $response->withStatus(404);
417
        }
418
        $entity = $entity[0];
419
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
420
        {
421
            return $response->withStatus(401);
422
        }
423
        $data = $request->getParsedBody();
424
        $myShift = $data['myshift'];
425
        $roles = array();