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

CareCleaningDoc::canCreate()   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 CareCleaningDoc 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 = 'Care & Cleaning Doc';
9
10
    /**
11
     * @var string
12
     */
13
    private static $plural_name = 'Care & Cleaning Docs';
14
15
    /**
16
     * @return FieldList
17
     */
18 2
    public function getCMSFields()
19
    {
20 2
        $fields = parent::getCMSFields();
21
22 2
        $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/CareCleaningDocs');
23
24 2
        return $fields;
25
    }
26
27
    /**
28
     * @return array
29
     */
30 1
    public function providePermissions()
31
    {
32
        return array(
33 1
            'Care_EDIT' => 'Edit Care and Cleaning Docs',
34 1
            'Care_DELETE' => 'Delete Care and Cleaning Docs',
35 1
            'Care_CREATE' => 'Create Care and Cleaning Docs',
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('Care_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('Care_EDIT', 'any', $member);
57
    }
58
59
    /**
60
     * @param null $member
61
     *
62
     * @return bool|int
63
     */
64 1
    public function canDelete($member = null)
65 1
    {
66 1
        return Permission::check('Care_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