Code Duplication    Length = 23-23 lines in 2 locations

api/v1/class.DepartmentAPI.php 1 location

@@ 237-259 (lines=23) @@
234
        return $response->withJson($shifts);
235
    }
236
237
    public function getRoleNameFromID($roleID)
238
    {
239
        static $roles = null;
240
        if($roles === null)
241
        {
242
            $dataTable = DataSetFactory::getDataTableByNames('fvs', 'roles');
243
            $tmp = $dataTable->read();
244
            $roles = array();
245
            $count = count($tmp);
246
            for($i = 0; $i < $count; $i++)
247
            {
248
                if(isset($tmp[$i]['display_name']))
249
                {
250
                    $roles[$tmp[$i]['short_name']] = $tmp[$i]['display_name'];
251
                }
252
                else
253
                {
254
                    $roles[$tmp[$i]['short_name']] = $tmp[$i]['short_name'];
255
                }
256
            }
257
        }
258
        return $roles[$roleID];
259
    }
260
261
    public function generateSimplePDFSchedule($dept, $shifts, $response)
262
    {

app/Schedules/class.ShiftSchedule.php 1 location

@@ 6-28 (lines=23) @@
3
4
trait ShiftSchedule
5
{
6
    public function getRoleNameFromID($roleID)
7
    {
8
        static $roles = null;
9
        if($roles === null)
10
        {
11
            $dataTable = \DataSetFactory::getDataTableByNames('fvs', 'roles');
12
            $tmp = $dataTable->read();
13
            $roles = array();
14
            $count = count($tmp);
15
            for($i = 0; $i < $count; $i++)
16
            {
17
                if(isset($tmp[$i]['display_name']))
18
                {
19
                    $roles[$tmp[$i]['short_name']] = $tmp[$i]['display_name'];
20
                }
21
                else
22
                {
23
                    $roles[$tmp[$i]['short_name']] = $tmp[$i]['short_name'];
24
                }
25
            }
26
        }
27
        return $roles[$roleID];
28
    }
29
}
30