Completed
Pull Request — master (#5)
by Nic
03:52
created

SampleManageableDataObject::getFrontEndActions()   A

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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * Class SampleManageableDataObject
5
 */
6
class SampleManageableDataObject extends DataObject implements PermissionProvider, ManageableDataObjectInterface, TestOnly
7
{
8
9
    /**
10
     * @var string
11
     */
12
    private static $listing_page_class = SampleManageableObjectPage::class;
0 ignored issues
show
Unused Code introduced by
The property $listing_page_class is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
13
14
    /**
15
     * @var array
16
     */
17
    private static $extensions = [
18
        \Dynamic\ViewableDataObject\Extensions\ViewableDataObject::class,
19
        ManageableObjectDataExtension::class,
20
    ];
21
22
    /**
23
     * @return array
24
     */
25
    public function providePermissions()
26
    {
27
        return [
28
            'MDO_Create',
29
            'MDO_Edit',
30
            'MDO_Delete',
31
            'MDO_View',
32
        ];
33
    }
34
35
    /**
36
     * @param null $member
37
     *
38
     * @return bool|int
39
     */
40 3
    public function canCreate($member = null)
41
    {
42 3
        return Permission::check('MDO_Create', 'any', $member);
43
    }
44
45
    /**
46
     * @param null $member
47
     *
48
     * @return bool|int
49
     */
50 2
    public function canEdit($member = null)
51
    {
52 2
        return Permission::check('MDO_Edit', 'any', $member);
53
    }
54
55
    /**
56
     * @param null $member
57
     *
58
     * @return bool|int
59
     */
60 2
    public function canDelete($member = null)
61
    {
62 2
        return Permission::check('MDO_Delete', 'any', $member);
63
    }
64
65
    /**
66
     * @param null $member
67
     *
68
     * @return bool|int
69
     */
70
    public function canView($member = null)
71
    {
72
        return Permission::check('MDO_View', 'any', $member);
73
    }
74
75
    /**
76
     * @param null $params
77
     *
78
     * @return FieldList
79
     */
80 4
    public function getFrontEndFields($params = null)
81
    {
82 4
        return parent::getFrontEndFields();
83
    }
84
85
    /**
86
     * @return FieldList
87
     */
88 4
    public function getFrontEndActions()
89
    {
90 4
        return FieldList::create();
91
    }
92
93
    /**
94
     * @return RequiredFields
95
     */
96 4
    public function getFrontEndRequiredFields()
97
    {
98 4
        return RequiredFields::create();
99
    }
100
101
}