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:27
created

WebhookTracks::getObjectCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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\ReadableAttributes;
6
7
/**
8
 * response type is different between each carrier.
9
 * if carrier label is generated via shippo, you will get type same to Transaction object.
10
 * if not, you will get type same to Tracks object.
11
 */
12
class WebhookTracks
13
{
14
    use ReadableAttributes {
15
        // tracks object properties
16
        mayHaveAsString as public getCarrier;
17
        mayHaveAsString as public getTrackingNumber;
18
        mayHaveAsString as public getEta;
19
        // transaction object properties
20
        mayHaveAsString as public getObjectState;
21
        mayHaveAsString as public getObjectStatus;
22
        mayHaveAsString as public getObjectId;
23
        mayHaveAsString as public getObjectOwner;
24
        mayHaveAsString as public getLabelUrl;
25
        mayHaveAsString as public getTrackingUrlProvider;
26
        mayHaveAsString as public getCommercialInvoiceUrl;
27
        mayHaveAsString as public getCustomsNote;
28
        mayHaveAsString as public getSubmissionNote;
29
        mayHaveAsString as public getMetadata;
30
        mayHaveAsArray  as public getMessages;
31
        // common properties
32
        mayHaveAsString as public getTrackingNumber;
33
        toArray as public __toArray;
34
    }
35
36
    /**
37
     * transaction object property
38
     *
39
     * @return \DateTime
40
     */
41
    public function getObjectCreated()
42
    {
43
        return $this->attributes->mayHave('object_created')->asInstanceOf('\\DateTime');
0 ignored issues
show
Bug introduced by
The property attributes does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
44
    }
45
46
    /**
47
     * transaction object property
48
     *
49
     * @return \DateTime
50
     */
51
    public function getObjectUpdated()
52
    {
53
        return $this->attributes->mayHave('object_updated')->asInstanceOf('\\DateTime');
54
    }
55
56
    /**
57
     * tracks object property
58
     *
59
     * @return \ShippoClient\Entity\Location
60
     */
61
    public function getAddressFrom()
62
    {
63
        $addressFrom = $this->attributes->mayHave('address_from')->asArray();
64
65
        return new Location($addressFrom);
66
    }
67
68
    /**
69
     * tracks object property
70
     *
71
     * @return \ShippoClient\Entity\Location
72
     */
73
    public function getAddressTo()
74
    {
75
        $addressTo = $this->attributes->mayHave('address_to')->asArray();
76
77
        return new Location($addressTo);
78
    }
79
80
    /**
81
     * tracks object property
82
     *
83
     * @return \ShippoClient\Entity\ServiceLevel
84
     */
85
    public function getServiceLevel()
86
    {
87
        $serviceLevel = $this->attributes->mayHave('servicelevel')->asArray();
88
89
        return new ServiceLevel($serviceLevel);
90
    }
91
92
    /**
93
     * common property
94
     *
95
     * @return \ShippoClient\Entity\TrackingStatus
96
     */
97
    public function getTrackingStatus()
98
    {
99
        return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
100
    }
101
102
    /**
103
     * common property
104
     *
105
     * @return \ShippoClient\Entity\TrackingHistory
106
     */
107
    public function getTrackingHistory()
108
    {
109
        $entities = $this->attributes->mayHave('tracking_history')
110
            ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
111
112
        return new TrackingHistory($entities);
113
    }
114
115
    public function toArray()
116
    {
117
        return [
118
            // tracks
119
            'carrier'                => $this->getCarrier(),
0 ignored issues
show
Bug introduced by
The method getCarrier() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
120
            'tracking_number'        => $this->getTrackingNumber(),
121
            'tracking_status'        => $this->getTrackingStatus()->toArray(),
122
            'tracking_history'       => $this->getTrackingHistory()->toArray(),
123
            'eta'                    => $this->getEta(),
0 ignored issues
show
Bug introduced by
The method getEta() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
124
            'address_from'           => $this->getAddressFrom()->toArray(),
125
            'address_to'             => $this->getAddressTo()->toArray(),
126
            'servicelevel'           => $this->getServiceLevel()->toArray(),
127
            // transaction
128
            'object_state'           => $this->getObjectState(),
0 ignored issues
show
Bug introduced by
The method getObjectState() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
129
            'object_status'          => $this->getObjectStatus(),
0 ignored issues
show
Bug introduced by
The method getObjectStatus() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
130
            'object_created'         => $this->getObjectCreated(),
131
            'object_updated'         => $this->getObjectUpdated(),
132
            'object_id'              => $this->getObjectId(),
0 ignored issues
show
Bug introduced by
The method getObjectId() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
133
            'object_owner'           => $this->getObjectOwner(),
0 ignored issues
show
Bug introduced by
The method getObjectOwner() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
134
            'label_url'              => $this->getLabelUrl(),
0 ignored issues
show
Bug introduced by
The method getLabelUrl() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
135
            'tracking_url_provider'  => $this->getTrackingUrlProvider(),
0 ignored issues
show
Bug introduced by
The method getTrackingUrlProvider() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
136
            'commercial_invoice_url' => $this->getCommercialInvoiceUrl(),
0 ignored issues
show
Bug introduced by
The method getCommercialInvoiceUrl() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
            'customs_note'           => $this->getCustomsNote(),
0 ignored issues
show
Bug introduced by
The method getCustomsNote() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
138
            'submission_note'        => $this->getSubmissionNote(),
0 ignored issues
show
Bug introduced by
The method getSubmissionNote() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
139
            'metadata'               => $this->getMetadata(),
0 ignored issues
show
Bug introduced by
The method getMetadata() does not seem to exist on object<ShippoClient\Entity\WebhookTracks>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
140
            'messages'               => $this->getMessages(),
141
        ];
142
    }
143
}
144