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 — develop ( a2e4fd...2509d0 )
by Samuel
05:31
created

GetNearestPostOffice::buildRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
namespace LinusShops\CanadaPost\Services;
3
use GuzzleHttp\Client;
4
use GuzzleHttp\Psr7\Request;
5
use LinusShops\CanadaPost\Service;
6
/**
7
 * Get the nearest post office
8
 *
9
 * @see https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/findpostoffice/nearestpostoffice.jsf
10
 * @author Sam Schmidt <[email protected]>
11
 * @since 2015-12-09
12
 * @company Linus Shops
13
 */
14
15
class GetNearestPostOffice extends Service
16
{
17 3
    private function getUri()
18
    {
19 3
        $uri = "/rs/postoffice?";
20 3
        if ($this->hasParameter('d2po')) {
21 3
            $uri .= "d2po={$this->getParameter('d2po')}&";
22 3
        }
23
24 3
        if ($this->hasParameter('tonight')) {
25
            $uri .= "tonight={$this->getParameter('tonight')}&";
26
        }
27
28 3
        $uri .= "maximum={$this->getParameter('maximum', 10)}&";
29
30 3
        if ($this->hasParameter('longitude') && $this->hasParameter('latitude')) {
31 2
            $uri .= "longitude={$this->getParameter('longitude')}&";
32 2
            $uri .= "latitude={$this->getParameter('latitude')}&";
33 2
        } else {
34 1
            $uri .= "postalCode={$this->getParameter('postalCode')}&";
35 1
            $uri .= "province={$this->getParameter('province')}&";
36 1
            $uri .= "city={$this->getParameter('city')}&";
37 1
            $uri .= "streetName={$this->getParameter('streetName')}&";
38
        }
39
40 3
        return $uri;
41
    }
42
43
    /**
44
     * @return Request
45
     */
46 3
    protected function buildRequest()
47
    {
48 3
        $request = new Request('GET', $this->getUri());
49 3
        $this->setHeader('Accept', 'application/vnd.cpc.postoffice+xml ');
50 3
        return $request;
51
    }
52
}
53