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 ( c3b60f...35c3e9 )
by Niels
04:43
created

Request::setMessageFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php namespace Ntholenaar\MultiSafepayClient\Request;
2
3
use Http\Discovery\MessageFactoryDiscovery;
4
use Http\Discovery\UriFactoryDiscovery;
5
use Http\Message\MessageFactory;
6
use Http\Message\UriFactory;
7
use Psr\Http\Message\UriInterface;
8
9
class Request implements RequestInterface
10
{
11
    /**
12
     * @var MessageFactory
13
     */
14
    protected $messageFactory;
15
16
    /**
17
     * @var UriFactory
18
     */
19
    protected $uriFactory;
20
21
    /**
22
     * @var string
23
     */
24
    protected $baseUrl = '';
25
26
    /**
27
     * @param MessageFactory|null $messageFactory
28
     * @param UriFactory|null $uriFactory
29
     */
30
    public function __construct(MessageFactory $messageFactory = null, UriFactory $uriFactory = null)
31
    {
32
        if (is_null($messageFactory)) {
33
            $messageFactory = MessageFactoryDiscovery::find();
34
        }
35
36
        if (is_null($uriFactory)) {
37
            $uriFactory = UriFactoryDiscovery::find();
38
        }
39
40
        $this->setUriFactory($uriFactory);
41
42
        $this->setMessageFactory($messageFactory);
43
44
    }
45
46
    /**
47
     * Get the MessageFactory.
48
     *
49
     * @return MessageFactory
50
     */
51
    protected function getMessageFactory()
52
    {
53
        return $this->messageFactory;
54
    }
55
56
    /**
57
     * Set the MessageFactory.
58
     *
59
     * @param MessageFactory $messageFactory
60
     * @return $this
61
     */
62
    protected function setMessageFactory(MessageFactory $messageFactory)
63
    {
64
        $this->messageFactory = $messageFactory;
65
66
        return $this;
67
    }
68
69
    /**
70
     * Get the UriFactory.
71
     *
72
     * @return UriFactory
73
     */
74
    protected function getUriFactory()
75
    {
76
        return $this->uriFactory;
77
    }
78
79
    /**
80
     * Set the UriFactory.
81
     *
82
     * @param UriFactory $uriFactory
83
     * @return $this
84
     */
85
    protected function setUriFactory(UriFactory $uriFactory)
86
    {
87
        $this->uriFactory = $uriFactory;
88
89
        return $this;
90
    }
91
92
    /**
93
     * Get the base url.
94
     *
95
     * @return string
96
     */
97
    protected function getBaseUrl()
98
    {
99
        return $this->baseUrl;
100
    }
101
102
    /**
103
     * Set the base url.
104
     *
105
     * @param $baseUrl
106
     * @return $this
107
     */
108
    protected function setBaseUrl($baseUrl)
109
    {
110
        $this->baseUrl = $baseUrl;
111
112
        return $this;
113
    }
114
115
    /**
116
     *
117
     * @param UriInterface $uri
118
     * @param array $query
119
     * @return \Psr\Http\Message\RequestInterface
120
     */
121
    protected function get(UriInterface $uri, array $query = array())
122
    {
123
        $uri = $uri->withQuery(http_build_query($query));
124
125
        return $this->messageFactory->createRequest('GET', $uri);
126
    }
127
}