Completed
Pull Request — master (#17)
by Jason
09:31
created

OperationManual::canDelete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3 View Code Duplication
class OperationManual extends ProductDoc implements PermissionProvider
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4
{
5
    /**
6
     * @var string
7
     */
8
    private static $singular_name = 'Operation Manual';
9
10
    /**
11
     * @var string
12
     */
13
    private static $plural_name = 'OperationManuals';
14
15
    /**
16
     * @return FieldList
17
     */
18 1
    public function getCMSFields()
19
    {
20 1
        $fields = parent::getCMSFields();
21
22 1
        $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/OperationManuals');
23
24 1
        return $fields;
25
    }
26
27
    /**
28
     * @return array
29
     */
30 1
    public function providePermissions()
31
    {
32
        return array(
33 1
            'Operation_EDIT' => 'Edit Operation Manuals',
34 1
            'Operation_DELETE' => 'Delete Operation Manuals',
35 1
            'Operation_CREATE' => 'Create Operation Manuals',
36 1
        );
37
    }
38
39
    /**
40
     * @param null $member
41
     *
42
     * @return bool|int
43
     */
44 1
    public function canCreate($member = null)
45
    {
46 1
        return Permission::check('Operation_CREATE', 'any', $member);
47
    }
48
49
    /**
50
     * @param null $member
51
     *
52
     * @return bool|int
53
     */
54 1
    public function canEdit($member = null)
55
    {
56 1
        return Permission::check('Operation_EDIT', 'any', $member);
57
    }
58
59
    /**
60
     * @param null $member
61
     *
62
     * @return bool|int
63
     */
64 1
    public function canDelete($member = null)
65
    {
66 1
        return Permission::check('Operation_DELETE', 'any', $member);
67
    }
68
69
    /**
70
     * @param null $member
71
     *
72
     * @return bool
73
     */
74 1
    public function canView($member = null)
75
    {
76 1
        return true;
77
    }
78
}
79