Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 253-256 (lines=4) @@
250
            return $response->withStatus(404);
251
        }
252
        $entity = $entity[0];
253
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
254
        {
255
            return $response->withStatus(401);
256
        }
257
        $shift = new \VolunteerShift($shiftId, $entity);
258
        $entity = $this->processShift($entity, $request);
259
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 386-389 (lines=4) @@
383
            return $response->withStatus(404);
384
        }
385
        $entity = $entity[0];
386
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
387
        {
388
            return $response->withStatus(401);
389
        }
390
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
391
        $entities = $dataTable->read($filter);
392
        $count = count($entities);
@@ 433-436 (lines=4) @@
430
            return $response->withStatus(404);
431
        }
432
        $entity = $entity[0];
433
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
434
        {
435
            return $response->withStatus(401);
436
        }
437
        $data = $request->getParsedBody();
438
        $myShift = $data['myshift'];
439
        $roles = array();