Code Duplication    Length = 17-17 lines in 2 locations

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
    {

api/v1/class.EventAPI.php 1 location

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