Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 202-205 (lines=4) @@
199
            return $response->withStatus(404);
200
        }
201
        $entity = $entity[0];
202
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
203
        {
204
            return $response->withStatus(401);
205
        }
206
        $shift = new \VolunteerShift($shiftId, $entity);
207
        $entity = $this->processShift($entity, $request);
208
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
@@ 338-341 (lines=4) @@
335
            return $response->withStatus(404);
336
        }
337
        $entity = $entity[0];
338
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
339
        {
340
            return $response->withStatus(401);
341
        }
342
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
343
        $entities = $dataTable->read($filter);
344
        $count = count($entities);
@@ 385-388 (lines=4) @@
382
            return $response->withStatus(404);
383
        }
384
        $entity = $entity[0];
385
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
386
        {
387
            return $response->withStatus(401);
388
        }
389
        $data = $request->getParsedBody();
390
        $myShift = $data['myshift'];
391
        $roles = array();