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
Push — master ( 418d78...2b27f2 )
by Sho
7s
created

WebhookTracks::getAddressTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
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 getEta;
18
        // transaction object properties
19
        mayHaveAsString as public getObjectState;
20
        mayHaveAsString as public getObjectStatus;
21
        mayHaveAsString as public getObjectId;
22
        mayHaveAsString as public getObjectOwner;
23
        mayHaveAsString as public getLabelUrl;
24
        mayHaveAsString as public getTrackingUrlProvider;
25
        mayHaveAsString as public getCommercialInvoiceUrl;
26
        mayHaveAsString as public getCustomsNote;
27
        mayHaveAsString as public getSubmissionNote;
28
        mayHaveAsString as public getMetadata;
29
        mayHaveAsArray  as public getMessages;
30
        // common properties
31
        mayHaveAsString as public getTrackingNumber;
32
        toArray as public __toArray;
33
    }
34
35
    /**
36
     * transaction object property
37
     *
38
     * @return \DateTime
39
     */
40
    public function getObjectCreated()
41
    {
42
        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...
43
    }
44
45
    /**
46
     * transaction object property
47
     *
48
     * @return \DateTime
49
     */
50
    public function getObjectUpdated()
51
    {
52
        return $this->attributes->mayHave('object_updated')->asInstanceOf('\\DateTime');
53
    }
54
55
    /**
56
     * tracks object property
57
     *
58
     * @return \ShippoClient\Entity\Location
59
     */
60
    public function getAddressFrom()
61
    {
62
        $addressFrom = $this->attributes->mayHave('address_from')->asArray();
63
64
        return new Location($addressFrom);
65
    }
66
67
    /**
68
     * tracks object property
69
     *
70
     * @return \ShippoClient\Entity\Location
71
     */
72
    public function getAddressTo()
73
    {
74
        $addressTo = $this->attributes->mayHave('address_to')->asArray();
75
76
        return new Location($addressTo);
77
    }
78
79
    /**
80
     * tracks object property
81
     *
82
     * @return \ShippoClient\Entity\ServiceLevel
83
     */
84
    public function getServiceLevel()
85
    {
86
        $serviceLevel = $this->attributes->mayHave('servicelevel')->asArray();
87
88
        return new ServiceLevel($serviceLevel);
89
    }
90
91
    /**
92
     * common property
93
     *
94
     * @return \ShippoClient\Entity\TrackingStatus
95
     */
96
    public function getTrackingStatus()
97
    {
98
        return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
99
    }
100
101
    /**
102
     * common property
103
     *
104
     * @return \ShippoClient\Entity\TrackingHistory
105
     */
106
    public function getTrackingHistory()
107
    {
108
        $entities = $this->attributes->mayHave('tracking_history')
109
            ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
110
111
        return new TrackingHistory($entities);
112
    }
113
114
    public function toArray()
115
    {
116
        return [
117
            // tracks
118
            '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...
119
            'tracking_number'        => $this->getTrackingNumber(),
120
            'tracking_status'        => $this->getTrackingStatus()->toArray(),
121
            'tracking_history'       => $this->getTrackingHistory()->toArray(),
122
            '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...
123
            'address_from'           => $this->getAddressFrom()->toArray(),
124
            'address_to'             => $this->getAddressTo()->toArray(),
125
            'servicelevel'           => $this->getServiceLevel()->toArray(),
126
            // transaction
127
            '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...
128
            '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...
129
            'object_created'         => $this->getObjectCreated(),
130
            'object_updated'         => $this->getObjectUpdated(),
131
            '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...
132
            '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...
133
            '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...
134
            '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...
135
            '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...
136
            '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...
137
            '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...
138
            '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...
139
            'messages'               => $this->getMessages(),
140
        ];
141
    }
142
}
143