TimeslotPolicy::userCheck()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace plunner\Policies;
4
5
use plunner\PolicyCheckable;
6
use plunner\Timeslot;
7
8
/**
9
 * Class TimeslotPolicy
10
 * @package plunner\Policies
11
 * @author Claudio Cardinale <[email protected]>
12
 * @copyright 2015 Claudio Cardinale
13
 * @version 1.0.0
14
 */
15
class TimeslotPolicy
16
{
17
    /**
18
     * Create a new policy instance.
19
     *
20
     * @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...
21
     */
22 12
    public function __construct()
23
    {
24
        //
25 12
    }
26
27
    /**
28
     * @param PolicyCheckable $policyCheckable
29
     * @param Timeslot $timeslot
30
     * @return bool
31
     */
32
    public function index(PolicyCheckable $policyCheckable, Timeslot $timeslot)
33
    {
34
        return $this->userCheck($policyCheckable, $timeslot);
35
    }
36
37
    /**
38
     * @param PolicyCheckable $policyCheckable
39
     * @param Timeslot $timeslot
40
     * @return bool
41
     */
42 12
    private function userCheck(PolicyCheckable $policyCheckable, Timeslot $timeslot)
43
    {
44 12
        return $policyCheckable->verifyTimeslot($timeslot);
45
    }
46
47
    /**
48
     * @param PolicyCheckable $policyCheckable
49
     * @param Timeslot $timeslot
50
     * @return bool
51
     */
52
    public function store(PolicyCheckable $policyCheckable, Timeslot $timeslot)
53
    {
54
        return $this->userCheck($policyCheckable, $timeslot);
55
    }
56
57
    /**
58
     * @param PolicyCheckable $policyCheckable
59
     * @param Timeslot $timeslot
60
     * @return bool
61
     */
62 3
    public function update(PolicyCheckable $policyCheckable, Timeslot $timeslot)
63
    {
64 3
        return $this->userCheck($policyCheckable, $timeslot);
65
    }
66
67
    /**
68
     * @param PolicyCheckable $policyCheckable
69
     * @param Timeslot $timeslot
70
     * @return bool
71
     */
72 9
    public function show(PolicyCheckable $policyCheckable, Timeslot $timeslot)
73
    {
74 9
        $ret = $this->userCheck($policyCheckable, $timeslot);
75 9
        return $ret;
76
    }
77
78
    /**
79
     * @param PolicyCheckable $policyCheckable
80
     * @param Timeslot $timeslot
81
     * @return bool
82
     */
83 3
    public function destroy(PolicyCheckable $policyCheckable, Timeslot $timeslot)
84
    {
85 3
        return $this->userCheck($policyCheckable, $timeslot);
86
    }
87
}
88