Code Duplication    Length = 17-17 lines in 2 locations

api/v1/class.EventAPI.php 1 location

@@ 93-109 (lines=17) @@
90
        return $response->withJson($shifts);
91
    }
92
93
    public function createShiftForEvent($request, $response, $args)
94
    {
95
        $eventId = $args['event'];
96
        if($this->canUpdate($request, null) === false)
97
        {
98
            return $response->withStatus(401);
99
        }
100
        $dataTable = DataSetFactory::getDataTableByNames('fvs', 'shifts');
101
        $obj = $request->getParsedBody();
102
        if($obj == NULL)
103
        {
104
            $obj = json_decode($request->getBody()->getContents(), true);
105
        }
106
        $obj['eventID'] = $eventId;
107
        $ret = $dataTable->create($obj);
108
        return $response->withJson($ret);
109
    }
110
}
111

api/v1/class.DepartmentAPI.php 1 location

@@ 125-141 (lines=17) @@
122
        return $response->withJson($shifts);
123
    }
124
125
    protected function createEntityForDepartment($request, $response, $args, $table)
126
    {
127
        $deptId = $args['dept'];
128
        if($this->canEditDept($request, $deptId) === false)
129
        {
130
            return $response->withStatus(401);
131
        }
132
        $dataTable = DataSetFactory::getDataTableByNames('fvs', $table);
133
        $obj = $request->getParsedBody();
134
        if($obj === null)
135
        {
136
            $obj = json_decode($request->getBody()->getContents(), true);
137
        }
138
        $obj['departmentID'] = $deptId;
139
        $ret = $dataTable->create($obj);
140
        return $response->withJson($ret);
141
    }
142
143
    public function createRoleForDepartment($request, $response, $args)
144
    {