DpsPxPayStoredCard   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 75
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A canCreate() 0 4 1
A canView() 0 13 4
A canEdit() 0 4 1
A canDelete() 0 8 2
1
<?php
2
3
class DpsPxPayStoredCard extends DataObject
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    private static $db = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $db 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...
6
        'CardName' => 'Varchar',
7
        'CardHolder' => 'Varchar',
8
        'CardNumber' => 'Varchar',
9
        'BillingID' => 'Varchar'
10
    );
11
12
    private static $has_one = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $has_one 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
        'Member' => 'Member'
14
    );
15
16
    private static $searchable_fields = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $searchable_fields 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...
17
        'CardHolder' => 'PartialMatchFilter',
18
        'CardNumber' => 'PartialMatchFilter'
19
    );
20
21
    //database related settings
22
    private static $field_labels = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $field_labels 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...
23
        'CardName' => 'Card Name',
24
        'CardHolder' => 'Card Holder',
25
        'CardNumber' => 'Card Number',
26
        'MemberID' => 'Card Owner'
27
    );
28
    private static $summary_fields = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $summary_fields 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...
29
        'CardName' => 'Card Name',
30
        'CardHolder' => 'Card Holder',
31
        'CardNumber' => 'Card Number',
32
        'Member.Title' => 'Card Owner'
33
    );
34
35
    private static $singular_name = "DPS PX Pay Stored Card";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $singular_name 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...
36
37
    private static $plural_name = "DPS PX Pay Stored Cards";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $plural_name 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...
38
39
    private static $default_sort = "Created DESC";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $default_sort 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...
40
41
    private static $defaults = array();//use fieldName => Default Value
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $defaults 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...
42
43
    private static $can_create = false;
0 ignored issues
show
Unused Code introduced by
The property $can_create 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...
44
45
    public function canCreate($member = null)
46
    {
47
        return false;
48
    }
49
50
    public function canView($member = null)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
51
    {
52
        if (!$member) {
53
            $member = Member::currentUser();
54
        }
55
        $extended = $this->extendedCan(__FUNCTION__, $member);
56
        if ($extended !== null) {
57
            return $extended;
58
        }
59
        if ($member) {
60
            return $member->IsAdmin();
61
        }
62
    }
63
64
    public function canEdit($member = null)
65
    {
66
        return false;
67
    }
68
69
    public function canDelete($member = null)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
70
    {
71
        $extended = $this->extendedCan(__FUNCTION__, $member);
72
        if ($extended !== null) {
73
            return $extended;
74
        }
75
        return $this->canView($member = null);
76
    }
77
}
78