gong023 /
shippo-http-client
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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'); |
||
| 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
|
|||
| 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
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
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
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
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
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
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
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
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
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
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
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 |
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.