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 ( d2378f...d01cde )
by Sho
02:24
created

ShippoClient::tracks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace ShippoClient;
3
4
use ShippoClient\Http\Request;
5
use ShippoClient\Http\Request\MockCollection;
6
7
class ShippoClient
8
{
9
    /**
10
     * @var Request
11
     */
12
    private $request;
13
14
    /**
15
     * @var string
16
     */
17
    private $accessToken;
18
19
    /**
20
     * @var static|null
21
     */
22
    private static $instance = null;
23
24
    private function __construct(Request $request)
25
    {
26
        $this->request = $request;
27
    }
28
29
    public function addresses()
30
    {
31
        return new Addresses($this->request);
32
    }
33
34
    public function parcels()
35
    {
36
        return new Parcels($this->request);
37
    }
38
39
    public function shipments()
40
    {
41
        return new Shipments($this->request);
42
    }
43
44
    public function rates()
45
    {
46
        return new Rates($this->request);
47
    }
48
49
    public function transactions()
50
    {
51
        return new Transactions($this->request);
52
    }
53
54
    public function refunds()
55
    {
56
        return new Refunds($this->request);
57
    }
58
59
    public function tracks()
60
    {
61
        return new Tracks($this->request);
62
    }
63
64
    public function getAccessToken()
65
    {
66
        return $this->accessToken;
67
    }
68
69
    public function setRequestOption($keyOrPath, $value)
70
    {
71
        $this->request->setDefaultOption($keyOrPath, $value);
72
73
        return $this;
74
    }
75
76
    /**
77
     * @param string $accessToken
78
     * @return static
79
     */
80
    public static function provider($accessToken)
81
    {
82
        if (static::$instance !== null && static::$instance->getAccessToken() === $accessToken) {
0 ignored issues
show
Bug introduced by
Since $instance is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $instance to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
83
            return static::$instance;
0 ignored issues
show
Bug introduced by
Since $instance is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $instance to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
84
        }
85
86
        static::$instance = new static(new Request($accessToken));
0 ignored issues
show
Bug introduced by
Since $instance is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $instance to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
87
88
        return static::$instance;
0 ignored issues
show
Bug introduced by
Since $instance is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $instance to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
89
    }
90
91
    public static function mock()
92
    {
93
        return MockCollection::getInstance();
94
    }
95
}
96