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.

Tracks   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 7
dl 0
loc 73
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTrackingStatus() 0 4 1
A getTrackingHistory() 0 7 1
A getAddressFrom() 0 6 1
A getAddressTo() 0 6 1
A getServiceLevel() 0 6 1
A toArray() 0 13 1
1
<?php
2
3
namespace ShippoClient\Entity;
4
5
use TurmericSpice\ReadableAttributes;
6
7
class Tracks
8
{
9
    use ReadableAttributes {
10
        mayHaveAsString as public getCarrier;
11
        mayHaveAsString as public getTrackingNumber;
12
        mayHaveAsString as public getEta;
13
        mayHaveAsString as public getMetadata;
14
        toArray as public __toArray;
15
    }
16
17
    /**
18
     * @return \ShippoClient\Entity\TrackingStatus
19
     */
20
    public function getTrackingStatus()
21
    {
22
        return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
23
    }
24
25
    /**
26
     * @return \ShippoClient\Entity\TrackingHistory
27
     */
28
    public function getTrackingHistory()
29
    {
30
        $entities = $this->attributes->mayHave('tracking_history')
31
            ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
32
33
        return new TrackingHistory($entities);
34
    }
35
36
    /**
37
     * @return \ShippoClient\Entity\Location
38
     */
39
    public function getAddressFrom()
40
    {
41
        $addressFrom = $this->attributes->mayHave('address_from')->asArray();
42
43
        return new Location($addressFrom);
44
    }
45
46
    /**
47
     * @return \ShippoClient\Entity\Location
48
     */
49
    public function getAddressTo()
50
    {
51
        $addressTo = $this->attributes->mayHave('address_to')->asArray();
52
53
        return new Location($addressTo);
54
    }
55
56
    /**
57
     * @return \ShippoClient\Entity\ServiceLevel
58
     */
59
    public function getServiceLevel()
60
    {
61
        $serviceLevel = $this->attributes->mayHave('servicelevel')->asArray();
62
63
        return new ServiceLevel($serviceLevel);
64
    }
65
66
    public function toArray()
67
    {
68
        return [
69
            'carrier'          => $this->getCarrier(),
0 ignored issues
show
Bug introduced by
The method getCarrier() does not seem to exist on object<ShippoClient\Entity\Tracks>.

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...
70
            'tracking_number'  => $this->getTrackingNumber(),
0 ignored issues
show
Bug introduced by
The method getTrackingNumber() does not seem to exist on object<ShippoClient\Entity\Tracks>.

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...
71
            'tracking_status'  => $this->getTrackingStatus()->toArray(),
72
            'tracking_history' => $this->getTrackingHistory()->toArray(),
73
            'eta'              => $this->getEta(),
0 ignored issues
show
Bug introduced by
The method getEta() does not seem to exist on object<ShippoClient\Entity\Tracks>.

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...
74
            'address_from'     => $this->getAddressFrom()->toArray(),
75
            'address_to'       => $this->getAddressTo()->toArray(),
76
            'servicelevel'     => $this->getServiceLevel()->toArray(),
77
        ];
78
    }
79
}
80