GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#14)
by Sho
02:31
created

Transaction::getPickupDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace ShippoClient\Entity;
4
5
use TurmericSpice\Container;
6
use TurmericSpice\ReadableAttributes;
7
8
/**
9
 * @property \TurmericSpice\Container attributes
10
 */
11
class Transaction extends ObjectInformation
12
{
13
    use ReadableAttributes {
14
        mayHaveAsString  as public getCustomsNote;
15
        mayHaveAsString  as public getSubmissionNote;
16
        mayHaveAsString  as public getMetadata;
17
        mayHaveAsBoolean as public getNotificationEmailFrom;
18
        mayHaveAsBoolean as public getNotificationEmailTo;
19
        mayHaveAsString  as public getNotificationEmailOther;
20
        toArray          as public __toArray;
21
    }
22
23
    /**
24
     * Indicates the status of the Transaction.
25
     *  - "WAITING"
26
     *  - "QUEUED"
27
     *  - "SUCCESS"
28
     *  - "ERROR"
29
     *  - "REFUNDED"
30
     *  - "REFUNDPENDING"
31
     *  - "REFUNDREJECTED"
32
     *
33
     * @return string
34
     */
35
    public function getObjectStatus()
36
    {
37
        return $this->attributes->mayHave('object_status')->asString();
38
    }
39
40
    /**
41
     * Indicates whether the transaction has been sent to the corresponding carrier's test or production server.
42
     *
43
     * @return bool
44
     */
45
    public function getWasTest()
46
    {
47
        return $this->attributes->mayHave('was_test')->asBoolean();
48
    }
49
50
    /**
51
     * Rate object id.
52
     *
53
     * @return string
54
     */
55
    public function getRate()
56
    {
57
        return $this->attributes->mayHave('rate')->asString();
58
    }
59
60
    /**
61
     * The carrier-specific tracking number that can be used to track the Shipment.
62
     * A value will only be returned if the Rate is for a trackable Shipment and if the Transactions has been processed successfully.
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 133 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
63
     *
64
     * @return string
65
     */
66
    public function getTrackingNumber()
67
    {
68
        return $this->attributes->mayHave('tracking_number')->asString();
69
    }
70
71
    /**
72
     * The tracking information we currently have on file for this shipment. We regularly update this information.
73
     *
74
     * @return TrackingStatus
75
     */
76
    public function getTrackingStatus()
77
    {
78
        return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
79
    }
80
81
    /**
82
     * @return TrackingHistory
83
     */
84
    public function getTrackingHistory()
85
    {
86
        $entities = $this->attributes->mayHave('tracking_history')
87
            ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
88
89
        return new TrackingHistory($entities);
90
    }
91
92
    /**
93
     * A link to track this item on the carrier-provided tracking website.
94
     * A value will only be returned if tracking is available and the carrier provides such a service.
95
     *
96
     * @return string
97
     */
98
    public function getTrackingUrlProvider()
99
    {
100
        return $this->attributes->mayHave('tracking_url_provider')->asString();
101
    }
102
103
    /**
104
     * A URL pointing directly to the label in the format you've set in your settings.
105
     * A value will only be returned if the Transactions has been processed successfully.
106
     *
107
     * @return string
108
     */
109
    public function getLabelUrl()
110
    {
111
        return $this->attributes->mayHave('label_url')->asString();
112
    }
113
114
    /**
115
     * A URL pointing to the commercial invoice as a 8.5x11 inch PDF file.
116
     * A value will only be returned if the Transactions has been processed successfully and if the shipment is international.
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 126 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
117
     *
118
     * @return string
119
     */
120
    public function getCommercialInvoiceUrl()
121
    {
122
        return $this->attributes->mayHave('commercial_invoice_url')->asString();
123
    }
124
125
    /**
126
     * An array containing elements of the following schema:
127
     * "code" (string): an identifier for the corresponding message (not always available")
128
     * "message" (string): a publishable message containing further information.
129
     *
130
     * @return array
131
     */
132
    public function getMessages()
133
    {
134
        return $this->attributes->mayHave('messages')->asArray();
135
    }
136
137
    /**
138
     * @return mixed|null
139
     */
140
    public function getOrder()
141
    {
142
        return $this->attributes->mayHave('order')->value();
143
    }
144
145
    /**
146
     * @return string
147
     */
148
    public function getMetadata()
149
    {
150
        return $this->attributes->mayHave('metadata')->asString();
151
    }
152
153
    public function toArray()
154
    {
155
        $array = $this->__toArray();
156
        $array['tracking_status'] = $this->getTrackingStatus()->toArray();
157
        $array['tracking_history'] = $this->getTrackingHistory()->toArray();
158
159
        return $array;
160
    }
161
}
162