Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 260-263 (lines=4) @@
257
            return $response->withStatus(404);
258
        }
259
        $entity = $entity[0];
260
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
261
        {
262
            return $response->withStatus(401);
263
        }
264
        $shift = new \VolunteerShift($shiftId, $entity);
265
        $entity = $this->processShift($entity, $request);
266
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 393-396 (lines=4) @@
390
            return $response->withStatus(404);
391
        }
392
        $entity = $entity[0];
393
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
394
        {
395
            return $response->withStatus(401);
396
        }
397
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
398
        $entities = $dataTable->read($filter);
399
        $count = count($entities);
@@ 440-443 (lines=4) @@
437
            return $response->withStatus(404);
438
        }
439
        $entity = $entity[0];
440
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
441
        {
442
            return $response->withStatus(401);
443
        }
444
        $data = $request->getParsedBody();
445
        $myShift = $data['myshift'];
446
        $roles = array();