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.

TrackingStatus::getObjectCreated()   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
class TrackingStatus
8
{
9
    use ReadableAttributes {
10
        mayHaveAsString as public getStatusDetails;
11
        mayHaveAsString as public getStatusDate;
12
        toArray as __toArray;
13
    }
14
15
    /**
16
     * Date and time of object creation.
17
     *
18
     * @return \DateTime
19
     */
20
    public function getObjectCreated()
21
    {
22
        return $this->attributes->mayHave('object_created')->asInstanceOf('\\DateTime');
23
    }
24
25
    /**
26
     * Date and time of last object update.
27
     *
28
     * @return \DateTime
29
     */
30
    public function getObjectUpdated()
31
    {
32
        return $this->attributes->mayHave('object_updated')->asInstanceOf('\\DateTime');
33
    }
34
35
    /**
36
     * Unique identifier of the given object.
37
     *
38
     * @return string
39
     */
40
    public function getObjectId()
41
    {
42
        return $this->attributes->mayHave('object_id')->asString();
43
    }
44
45
    /**
46
     * Package status.
47
     *  - "UNKNOWN"   The package has not been found via the carrier's tracking system,
48
     *                or it has been found but not yet scanned by the carrier.
49
     *  - "TRANSIT"   The package has been scanned by the carrier and is in transit.
50
     *  - "DELIVERED" The package has been successfully delivered.
51
     *  - "RETURNED"  The package is en route to be returned to the sender, or has been returned successfully.
52
     *  - "FAILURE"   The carrier indicated that there has been an issue with the delivery.
53
     *                This can happen for various reasons and depends on the carrier.
54
     *                This status does not indicate a technical error, but rather a delivery issue.
55
     *
56
     * @return string
57
     */
58
    public function getStatus()
59
    {
60
        return $this->attributes->mayHave('status')->asString();
61
    }
62
63
    /**
64
     * @return Location
65
     */
66
    public function getLocation()
67
    {
68
        $attributes = $this->attributes->mayHave('location')->asArray();
69
        return new Location($attributes);
70
    }
71
72
    public function toArray()
73
    {
74
        return [
75
            'object_created' => $this->getObjectCreated(),
76
            'object_updated' => $this->getObjectUpdated(),
77
            'object_id'      => $this->getObjectId(),
78
            'status'         => $this->getStatus(),
79
            'status_date'    => $this->getStatusDate(),
80
            'status_details' => $this->getStatusDetails(),
0 ignored issues
show
Bug introduced by
The method getStatusDetails() does not exist on ShippoClient\Entity\TrackingStatus. Did you maybe mean getStatus()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
81
            'location'       => $this->getLocation()->toArray(),
82
        ];
83
    }
84
}
85