Completed
Push — master ( f2f6fa...1beb9c )
by claudio
03:43
created

EmployeePolicy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 71.43%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 7
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 72
ccs 10
cts 14
cp 0.7143
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A index() 0 4 1
A store() 0 4 1
A update() 0 4 1
A show() 0 4 1
A destroy() 0 4 1
A userCheck() 0 4 1
1
<?php
2
3
namespace plunner\Policies;
4
5
use plunner\Company;
6
use plunner\Employee;
7
8
class EmployeePolicy
9
{
10
    /**
11
     * Create a new policy instance.
12
     *
13
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
14
     */
15 4
    public function __construct()
16
    {
17
        //
18 4
    }
19
20
    /**
21
     * @param Company $company
22
     * @param Employee $employee
23
     * @return bool
24
     */
25
    public function index(Company $company, Employee $employee)
26
    {
27
        return $this->userCheck($company, $employee);
28
    }
29
30
    /**
31
     * @param Company $company
32
     * @param Employee $employee
33
     * @return bool
34
     */
35
    public function store(Company $company, Employee $employee)
36
    {
37
        return $this->userCheck($company, $employee);
38
    }
39
40
    /**
41
     * @param Company $company
42
     * @param Employee $employee
43
     * @return bool
44
     */
45 1
    public function update(Company $company, Employee $employee)
46
    {
47 1
        return $this->userCheck($company, $employee);
48
    }
49
50
    /**
51
     * @param Company $company
52
     * @param Employee $employee
53
     * @return bool
54
     */
55 2
    public function show(Company $company, Employee $employee)
56
    {
57 2
        return $this->userCheck($company, $employee);
58
    }
59
60
    /**
61
     * @param Company $company
62
     * @param Employee $employee
63
     * @return bool
64
     */
65 2
    public function destroy(Company $company, Employee $employee)
66
    {
67 2
        return $this->userCheck($company, $employee);
68
    }
69
70
    /**
71
     * @param Company $company
72
     * @param Employee $employee
73
     * @return bool
74
     */
75 4
    private function userCheck(Company $company, Employee $employee)
76
    {
77 4
        return $company->id === $employee->company_id;
78
    }
79
}
80