Event::getCreatedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Moip\Resource;
4
5
use stdClass;
6
7
/**
8
 * Class Event.
9
 */
10
class Event extends MoipResource
11
{
12
    /**
13
     * @const string
14
     */
15
    const PATH = 'events';
16
17
    /**
18
     * Initialize a new instance.
19
     */
20
    public function initialize()
21
    {
22
        $this->data = new stdClass();
23
        $this->data->type = null;
24
        $this->data->createdAt = null;
25
        $this->data->descriotion = null;
26
    }
27
28
    /**
29
     * Get event Type.
30
     *
31
     * @return string possible values:
32
     *                ORDER.CREATED
33
     *                ORDER.PAID
34
     *                ORDER.NOT_PAID
35
     *                ORDER.PAID
36
     *                ORDER.REVERTED
37
     *                PAYMENT.AUTHORIZED
38
     *                PAYMENT.IN_ANALYSIS
39
     *                PAYMENT.CANCELLED
40
     *                ENTRY.SETTLED
41
     *                PLAN.CREATED
42
     *                PLAN.UPDATED
43
     *                PLAN.ACTIVATED
44
     *                PLAN.INACTIVATED
45
     *                CUSTOMER.CREATED
46
     *                CUSTOMER.UPDATED
47
     *                SUBSCRIPTION.CREATED
48
     *                SUBSCRIPTION.UPDATE
49
     *                SUBSCRIPTION.ACTIVATED
50
     *                SUBSCRIPTION.SUSPENDED
51
     *                SUBSCRIPTION.CANCELED
52
     *                INVOICE.CREATED
53
     *                INVOICE.UPDATED
54
     */
55
    public function getType()
56
    {
57
        return $this->data->type;
58
    }
59
60
    /**
61
     * Get creation date of the event.
62
     *
63
     * @return \DateTime
64
     */
65
    public function getCreatedAt()
66
    {
67
        // todo: didn't find Events on documentation but i'm assuming it's a datetime, have to confirm it
68
        return $this->getIfSetDateTime('createdAt');
69
    }
70
71
    /**
72
     * Get event Description.
73
     *
74
     * @return string
75
     */
76
    public function getDescription()
77
    {
78
        return $this->data->description;
79
    }
80
81
    /**
82
     * Populate Event.
83
     *
84
     * @param \stdClass $response
85
     *
86
     * @return \stdClass
87
     */
88
    protected function populate(stdClass $response)
89
    {
90
        $this->data = $response;
91
    }
92
}
93