OperationManual::getCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 1
1
<?php
2
3
namespace Dynamic\ProductCatalog\Docs;
4
5
use SilverStripe\Security\Permission;
6
use SilverStripe\Security\PermissionProvider;
7
8
class OperationManual extends ProductDoc implements PermissionProvider
9
{
10
    /**
11
     * @var string
12
     */
13
    private static $singular_name = 'Operation Manual';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
14
15
    /**
16
     * @var string
17
     */
18
    private static $plural_name = 'OperationManuals';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
19
20
    /**
21
     * @var string
22
     */
23
    private static $table_name = 'OperationManual';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
24
25
    /**
26
     * @return FieldList
0 ignored issues
show
Bug introduced by
The type Dynamic\ProductCatalog\Docs\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...
27
     */
28 1
    public function getCMSFields()
29
    {
30 1
        $fields = parent::getCMSFields();
31
32 1
        $fields->dataFieldByName('Download')->setFolderName('Uploads/Products/OperationManuals');
33
34 1
        return $fields;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $fields returns the type SilverStripe\Forms\FieldList which is incompatible with the documented return type Dynamic\ProductCatalog\Docs\FieldList.
Loading history...
35
    }
36
37
    /**
38
     * @return array
39
     */
40 1
    public function providePermissions()
41
    {
42
        return array(
43 1
            'Operation_EDIT' => 'Edit Operation Manuals',
44
            'Operation_DELETE' => 'Delete Operation Manuals',
45
            'Operation_CREATE' => 'Create Operation Manuals',
46
        );
47
    }
48
49
    /**
50
     * @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...
51
     *
52
     * @return bool|int
53
     */
54 1
    public function canCreate($member = null, $context = [])
55
    {
56 1
        return Permission::check('Operation_CREATE', 'any', $member);
57
    }
58
59
    /**
60
     * @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...
61
     *
62
     * @return bool|int
63
     */
64 1
    public function canEdit($member = null, $context = [])
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

64
    public function canEdit($member = null, /** @scrutinizer ignore-unused */ $context = [])

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
65
    {
66 1
        return Permission::check('Operation_EDIT', 'any', $member);
67
    }
68
69
    /**
70
     * @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...
71
     *
72
     * @return bool|int
73
     */
74 1
    public function canDelete($member = null, $context = [])
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

74
    public function canDelete($member = null, /** @scrutinizer ignore-unused */ $context = [])

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
    {
76 1
        return Permission::check('Operation_DELETE', 'any', $member);
77
    }
78
79
    /**
80
     * @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...
81
     *
82
     * @return bool
83
     */
84 11
    public function canView($member = null, $context = [])
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

84
    public function canView($member = null, /** @scrutinizer ignore-unused */ $context = [])

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
85
    {
86 11
        return true;
87
    }
88
}
89