Code Duplication    Length = 4-4 lines in 3 locations

api/v1/class.ShiftAPI.php 3 locations

@@ 168-171 (lines=4) @@
165
            return $response->withStatus(404);
166
        }
167
        $entity = $entity[0];
168
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
169
        {
170
            return $response->withStatus(401);
171
        }
172
        $shift = new \VolunteerShift($shiftId, $entity);
173
        $entity = $this->processShift($entity, $request);
174
        if(isset($entity['overlap']) && $entity['overlap'])
@@ 300-303 (lines=4) @@
297
            return $response->withStatus(404);
298
        }
299
        $entity = $entity[0];
300
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
301
        {
302
            return $response->withStatus(401);
303
        }
304
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
305
        $entities = $dataTable->read($filter);
306
        $count = count($entities);
@@ 347-350 (lines=4) @@
344
            return $response->withStatus(404);
345
        }
346
        $entity = $entity[0];
347
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
348
        {
349
            return $response->withStatus(401);
350
        }
351
        $data = $request->getParsedBody();
352
        $myShift = $data['myshift'];
353
        $roles = array();