Passed
Push — master ( 2a4a9b...87d6cd )
by Jason
01:52
created

OrderHistory::getOrderList()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Dynamic\Foxy\Orders\Page;
4
5
use SilverStripe\Security\Security;
6
7
class OrderHistory extends \Page
8
{
9
    /**
10
     * @var string
11
     */
12
    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...
13
14
    /**
15
     * @var string
16
     */
17
    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...
18
19
    /**
20
     * @var string
21
     */
22
    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...
23
24
    /**
25
     * @var array
26
     */
27
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
28
        'PerPage' => 'Int',
29
    ];
30
31
    /**
32
     * @var array
33
     */
34
    private static $defaults = [
0 ignored issues
show
introduced by
The private property $defaults is not used, and could be removed.
Loading history...
35
        'PerPage' => 10,
36
    ];
37
38
    /**
39
     * @var string
40
     */
41
    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...
42
43
    /**
44
     * return all current Member's Orders.
45
     *
46
     * @return bool
47
     */
48
    public function getOrderList()
49
    {
50
        if ($Member = Security::getCurrentUser()) {
51
            $list = $Member->Orders()->sort('TransactionDate', 'DESC');
52
            return $list;
53
        }
54
55
        return false;
56
    }
57
}
58