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.

Shipments   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 7 1
A createByNestedCall() 0 7 1
A createReturn() 0 4 1
A retrieve() 0 6 1
A getList() 0 6 1
A getRateList() 0 6 1
1
<?php
2
3
namespace ShippoClient;
4
5
use ShippoClient\Entity\Shipment;
6
use ShippoClient\Http\Request;
7
use ShippoClient\Http\Request\Shipments\CreateObject;
8
use ShippoClient\Http\Request\Shipments\CreateObjectByNested;
9
use ShippoClient\Http\Response\RateList;
10
use ShippoClient\Http\Response\ShipmentList;
11
12
class Shipments
13
{
14
    private $request;
15
16
    public function __construct(Request $request)
17
    {
18
        $this->request = $request;
19
    }
20
21
    public function create(array $attributes)
22
    {
23
        $createObj = new CreateObject($attributes);
24
        $responseArray = $this->request->post('shipments', $createObj->toArray());
25
26
        return new Shipment($responseArray);
27
    }
28
29
    public function createByNestedCall(array $attributes)
30
    {
31
        $createObj = new CreateObjectByNested($attributes);
32
        $responseArray = $this->request->postWithJsonBody('shipments', $createObj->toArray());
33
34
        return new Shipment($responseArray);
35
    }
36
37
    public function createReturn()
38
    {
39
        // TODO
40
    }
41
42
    public function retrieve($objectId)
43
    {
44
        $responseArray = $this->request->get("shipments/$objectId");
45
46
        return new Shipment($responseArray);
47
    }
48
49
    /**
50
     * @param null|int $results
51
     * @return ShipmentList
52
     */
53
    public function getList($results = null)
54
    {
55
        $responseArray = $this->request->get("shipments", ['results' => $results]);
56
57
        return new ShipmentList($responseArray);
58
    }
59
60
    public function getRateList($objectId, $currencyCode = '')
61
    {
62
        $responseArray = $this->request->get("shipments/$objectId/rates/$currencyCode");
63
64
        return new RateList($responseArray);
65
    }
66
}
67