Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 221-224 (lines=4) @@
218
            return $response->withStatus(404);
219
        }
220
        $entity = $entity[0];
221
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
222
        {
223
            return $response->withStatus(401);
224
        }
225
        $shift = new \VolunteerShift($shiftId, $entity);
226
        $entity = $this->processShift($entity, $request);
227
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 357-360 (lines=4) @@
354
            return $response->withStatus(404);
355
        }
356
        $entity = $entity[0];
357
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
358
        {
359
            return $response->withStatus(401);
360
        }
361
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
362
        $entities = $dataTable->read($filter);
363
        $count = count($entities);
@@ 404-407 (lines=4) @@
401
            return $response->withStatus(404);
402
        }
403
        $entity = $entity[0];
404
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
405
        {
406
            return $response->withStatus(401);
407
        }
408
        $data = $request->getParsedBody();
409
        $myShift = $data['myshift'];
410
        $roles = array();