Completed
Pull Request — master (#12)
by Matthew
11:11
created

SampleManageableDataObject   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 17
dl 0
loc 93
rs 10
c 1
b 0
f 0
ccs 12
cts 20
cp 0.6

8 Methods

Rating   Name   Duplication   Size   Complexity  
A canDelete() 0 3 1
A getFrontEndRequiredFields() 0 3 1
A canEdit() 0 3 1
A providePermissions() 0 7 1
A canCreate() 0 3 1
A canView() 0 3 1
A getFrontEndFields() 0 3 1
A getFrontEndActions() 0 3 1
1
<?php
2
3
/**
4
 * Class SampleManageableDataObject
5
 */
6
class SampleManageableDataObject extends DataObject implements PermissionProvider, ManageableDataObjectInterface, TestOnly
0 ignored issues
show
Bug introduced by
The type DataObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type ManageableDataObjectInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type TestOnly was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type PermissionProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
{
8
9
    /**
10
     * @var string
11
     */
12
    private static $listing_page_class = SampleManageableObjectPage::class;
0 ignored issues
show
introduced by
The private property $listing_page_class is not used, and could be removed.
Loading history...
13
14
    /**
15
     * @var array
16
     */
17
    private static $extensions = [
0 ignored issues
show
introduced by
The private property $extensions is not used, and could be removed.
Loading history...
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
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
37
     *
38
     * @return bool|int
39
     */
40 3
    public function canCreate($member = null)
41
    {
42 3
        return Permission::check('MDO_Create', 'any', $member);
0 ignored issues
show
Bug introduced by
The type Permission was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
    }
44
45
    /**
46
     * @param null $member
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
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
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
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
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
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
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $params is correct as it would always require null to be passed?
Loading history...
77
     *
78
     * @return FieldList
0 ignored issues
show
Bug introduced by
The type FieldList was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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();
0 ignored issues
show
Bug introduced by
The type RequiredFields was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
99
    }
100
101
}