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)
@@ 397-400 (lines=4) @@
394
            return $response->withStatus(404);
395
        }
396
        $entity = $entity[0];
397
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
398
        {
399
            return $response->withStatus(401);
400
        }
401
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
402
        $entities = $dataTable->read($filter);
403
        $count = count($entities);
@@ 444-447 (lines=4) @@
441
            return $response->withStatus(404);
442
        }
443
        $entity = $entity[0];
444
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
445
        {
446
            return $response->withStatus(401);
447
        }
448
        $data = $request->getParsedBody();
449
        $myShift = $data['myshift'];
450
        $roles = array();