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::getUri()   B

Complexity

Conditions 5
Paths 8

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 5.0343

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 25
ccs 16
cts 18
cp 0.8889
rs 8.439
cc 5
eloc 16
nc 8
nop 0
crap 5.0343
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