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

EmployeePolicy::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
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