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.

Transaction::getTrackingNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace ShippoClient\Entity;
4
5
use TurmericSpice\ReadableAttributes;
6
7
/**
8
 * @property \TurmericSpice\Container attributes
9
 */
10
class Transaction extends ObjectInformation
11
{
12
    use ReadableAttributes {
13
        mayHaveAsString  as public getCustomsNote;
14
        mayHaveAsString  as public getSubmissionNote;
15
        mayHaveAsString  as public getMetadata;
16
        toArray          as public __toArray;
17
    }
18
19
    /**
20
     * Indicates the status of the Transaction.
21
     *  - "WAITING"
22
     *  - "QUEUED"
23
     *  - "SUCCESS"
24
     *  - "ERROR"
25
     *  - "REFUNDED"
26
     *  - "REFUNDPENDING"
27
     *  - "REFUNDREJECTED"
28
     *
29
     * @return string
30
     */
31
    public function getObjectStatus()
32
    {
33
        return $this->attributes->mayHave('object_status')->asString();
34
    }
35
36
    /**
37
     * Indicates whether the transaction has been sent to the corresponding carrier's test or production server.
38
     *
39
     * @return bool
40
     */
41
    public function getWasTest()
42
    {
43
        return $this->attributes->mayHave('was_test')->asBoolean();
44
    }
45
46
    /**
47
     * Rate object id.
48
     *
49
     * @return string
50
     */
51
    public function getRate()
52
    {
53
        return $this->attributes->mayHave('rate')->asString();
54
    }
55
56
    /**
57
     * The carrier-specific tracking number that can be used to track the Shipment.
58
     * 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...
59
     *
60
     * @return string
61
     */
62
    public function getTrackingNumber()
63
    {
64
        return $this->attributes->mayHave('tracking_number')->asString();
65
    }
66
67
    /**
68
     * The tracking information we currently have on file for this shipment. We regularly update this information.
69
     *
70
     * @return TrackingStatus
71
     */
72
    public function getTrackingStatus()
73
    {
74
        return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
75
    }
76
77
    /**
78
     * @return TrackingHistory
79
     */
80
    public function getTrackingHistory()
81
    {
82
        $entities = $this->attributes->mayHave('tracking_history')
83
            ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
84
85
        return new TrackingHistory($entities);
86
    }
87
88
    /**
89
     * A link to track this item on the carrier-provided tracking website.
90
     * A value will only be returned if tracking is available and the carrier provides such a service.
91
     *
92
     * @return string
93
     */
94
    public function getTrackingUrlProvider()
95
    {
96
        return $this->attributes->mayHave('tracking_url_provider')->asString();
97
    }
98
99
    /**
100
     * A URL pointing directly to the label in the format you've set in your settings.
101
     * A value will only be returned if the Transactions has been processed successfully.
102
     *
103
     * @return string
104
     */
105
    public function getLabelUrl()
106
    {
107
        return $this->attributes->mayHave('label_url')->asString();
108
    }
109
110
    /**
111
     * A URL pointing to the commercial invoice as a 8.5x11 inch PDF file.
112
     * 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...
113
     *
114
     * @return string
115
     */
116
    public function getCommercialInvoiceUrl()
117
    {
118
        return $this->attributes->mayHave('commercial_invoice_url')->asString();
119
    }
120
121
    /**
122
     * An array containing elements of the following schema:
123
     * "code" (string): an identifier for the corresponding message (not always available")
124
     * "message" (string): a publishable message containing further information.
125
     *
126
     * @return array
127
     */
128
    public function getMessages()
129
    {
130
        return $this->attributes->mayHave('messages')->asArray();
131
    }
132
133
    /**
134
     * @return mixed|null
135
     */
136
    public function getOrder()
137
    {
138
        return $this->attributes->mayHave('order')->value();
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function getMetadata()
145
    {
146
        return $this->attributes->mayHave('metadata')->asString();
147
    }
148
149
    public function toArray()
150
    {
151
        $array = $this->__toArray();
152
        $array['tracking_status'] = $this->getTrackingStatus()->toArray();
153
        $array['tracking_history'] = $this->getTrackingHistory()->toArray();
154
155
        return $array;
156
    }
157
}
158