Completed
Pull Request — master (#48)
by claudio
05:21
created

MeetingPolicy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 73.33%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 73
ccs 11
cts 15
cp 0.7333
rs 10
c 1
b 1
f 0

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 5 1
A destroy() 0 4 1
A userCheck() 0 4 1
1
<?php
2
3
namespace plunner\Policies;
4
5
use plunner\Meeting;
6
use plunner\PolicyCheckable;
7
8
/**
9
 * Class MeetingPolicy
10
 * @package plunner\Policies
11
 * @author Claudio Cardinale <[email protected]>
12
 * @copyright 2015 Claudio Cardinale
13
 * @version 1.0.0
14
 */
15
class MeetingPolicy
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 16
    public function __construct()
23
    {
24
        //
25 16
    }
26
27
    /**
28
     * @param PolicyCheckable $policyCheckable
29
     * @param Meeting $Meeting
30
     * @return bool
31
     */
32
    public function index(PolicyCheckable $policyCheckable, Meeting $Meeting)
33
    {
34
        return $this->userCheck($policyCheckable, $Meeting);
35
    }
36
37
    /**
38
     * @param PolicyCheckable $policyCheckable
39
     * @param Meeting $Meeting
40
     * @return bool
41
     */
42
    public function store(PolicyCheckable $policyCheckable, Meeting $Meeting)
43
    {
44
        return $this->userCheck($policyCheckable, $Meeting);
45
    }
46
47
    /**
48
     * @param PolicyCheckable $policyCheckable
49
     * @param Meeting $Meeting
50
     * @return bool
51
     */
52 6
    public function update(PolicyCheckable $policyCheckable, Meeting $Meeting)
53
    {
54 6
        return $this->userCheck($policyCheckable, $Meeting);
55
    }
56
57
    /**
58
     * @param PolicyCheckable $policyCheckable
59
     * @param Meeting $Meeting
60
     * @return bool
61
     */
62 4
    public function show(PolicyCheckable $policyCheckable, Meeting $Meeting)
63
    {
64 4
        $ret = $this->userCheck($policyCheckable, $Meeting);
65 4
        return $ret;
66
    }
67
68
    /**
69
     * @param PolicyCheckable $policyCheckable
70
     * @param Meeting $Meeting
71
     * @return bool
72
     */
73 6
    public function destroy(PolicyCheckable $policyCheckable, Meeting $Meeting)
74
    {
75 6
        return $this->userCheck($policyCheckable, $Meeting);
76
    }
77
78
    /**
79
     * @param PolicyCheckable $policyCheckable
80
     * @param Meeting $Meeting
81
     * @return bool
82
     */
83 16
    private function userCheck(PolicyCheckable $policyCheckable, Meeting $Meeting)
84
    {
85 16
        return $policyCheckable->verifyMeeting($Meeting);
86
    }
87
}
88