RoleAPI   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 9
c 4
b 0
f 0
dl 0
loc 31
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A canUpdate() 0 3 1
A processEntry() 0 3 1
A canEditDept() 0 7 2
A __construct() 0 3 1
A canDelete() 0 3 1
1
<?php
2
class RoleAPI extends VolunteerAPI
3
{
4
    use Processor;
0 ignored issues
show
introduced by
The trait Processor requires some properties which are not provided by RoleAPI: $startTime, $certs, $endTime, $mail, $uid, $title
Loading history...
5
6
    public function __construct()
7
    {
8
        parent::__construct('roles', 'short_name');
9
    }
10
11
    protected function canEditDept($request, $deptId)
12
    {
13
        if($this->isVolunteerAdmin($request))
14
        {
15
            return true;
16
        }
17
        return $this->isUserDepartmentLead($deptId, $this->user);
18
    }
19
20
    protected function canUpdate($request, $entity)
21
    {
22
        return $this->canEditDept($request, $entity['departmentID']);
23
    }
24
25
    protected function canDelete($request, $entity)
26
    {
27
        return $this->canUpdate($request, $entity);
28
    }
29
30
    protected function processEntry($entry, $request)
31
    {
32
        return $this->processRole($entry, $request);
33
    }
34
}
35
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
36