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.

Code Duplication    Length = 89-90 lines in 2 locations

src/ShippoClient.php 1 location

@@ 7-95 (lines=89) @@
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) {
83
            return static::$instance;
84
        }
85
86
        static::$instance = new static(new Request($accessToken));
87
88
        return static::$instance;
89
    }
90
91
    public static function mock()
92
    {
93
        return MockCollection::getInstance();
94
    }
95
}
96

src/ShippoClientV2.php 1 location

@@ 8-97 (lines=90) @@
5
use ShippoClient\Http\Request\MockCollection;
6
use ShippoClient\Http\RequestV2;
7
8
class ShippoClientV2
9
{
10
    /**
11
     * @var RequestV2
12
     */
13
    private $request;
14
15
    /**
16
     * @var string
17
     */
18
    private $accessToken;
19
20
    /**
21
     * @var static|null
22
     */
23
    private static $instance = null;
24
25
    private function __construct(RequestV2 $request)
26
    {
27
        $this->request = $request;
28
    }
29
30
    public function addresses()
31
    {
32
        return new Addresses($this->request);
33
    }
34
35
    public function parcels()
36
    {
37
        return new Parcels($this->request);
38
    }
39
40
    public function shipments()
41
    {
42
        return new Shipments($this->request);
43
    }
44
45
    public function rates()
46
    {
47
        return new Rates($this->request);
48
    }
49
50
    public function transactions()
51
    {
52
        return new Transactions($this->request);
53
    }
54
55
    public function refunds()
56
    {
57
        return new Refunds($this->request);
58
    }
59
60
    public function tracks()
61
    {
62
        return new Tracks($this->request);
63
    }
64
65
    public function getAccessToken()
66
    {
67
        return $this->accessToken;
68
    }
69
70
    public function setRequestOption($keyOrPath, $value)
71
    {
72
        $this->request->setDefaultOption($keyOrPath, $value);
73
74
        return $this;
75
    }
76
77
    /**
78
     * @param string $accessToken
79
     * @param null|string $apiVersion
80
     * @return static
81
     */
82
    public static function provider($accessToken, $apiVersion = null)
83
    {
84
        if (static::$instance !== null && static::$instance->getAccessToken() === $accessToken) {
85
            return static::$instance;
86
        }
87
88
        static::$instance = new static(new RequestV2($accessToken, $apiVersion));
89
90
        return static::$instance;
91
    }
92
93
    public static function mock()
94
    {
95
        return MockCollection::getInstance();
96
    }
97
}
98