OrderHistory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getOrderList() 0 9 2
1
<?php
2
3
namespace Dynamic\Foxy\Orders\Page;
4
5
use Dynamic\Foxy\Orders\Model\Order;
6
use SilverStripe\Security\Security;
7
8
/**
9
 * Class OrderHistory
10
 * @package Dynamic\Foxy\Orders\Page
11
 */
12
class OrderHistory extends \Page
13
{
14
    /**
15
     * @var string
16
     */
17
    private static $singular_name = 'Order History';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
18
19
    /**
20
     * @var string
21
     */
22
    private static $plural_name = 'Order Histories';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
23
24
    /**
25
     * @var string
26
     */
27
    private static $description = 'Show a customers past orders. Requires authentication';
0 ignored issues
show
introduced by
The private property $description is not used, and could be removed.
Loading history...
28
29
    /**
30
     * @var array
31
     */
32
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
33
        'PerPage' => 'Int',
34
    ];
35
36
    /**
37
     * @var array
38
     */
39
    private static $defaults = [
0 ignored issues
show
introduced by
The private property $defaults is not used, and could be removed.
Loading history...
40
        'PerPage' => 10,
41
    ];
42
43
    /**
44
     * @var string
45
     */
46
    private static $table_name = 'FoxyOrderHistory';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
47
48
    /**
49
     * return all current Member's Orders.
50
     *
51
     * @return bool|\SilverStripe\ORM\DataList
52
     */
53
    public function getOrderList()
54
    {
55
        if ($member = Security::getCurrentUser()) {
56
            $list = Order::get()->filter('Email', $member->Email)->sort('TransactionDate', 'DESC');
57
58
            return $list;
59
        }
60
61
        return false;
62
    }
63
}
64