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.

GetNearestPostOffice::getUri()   B
last analyzed

Complexity

Conditions 5
Paths 8

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 5.0342

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 5
eloc 16
c 3
b 0
f 0
nc 8
nop 0
dl 0
loc 25
ccs 16
cts 18
cp 0.8889
crap 5.0342
rs 8.439
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 5
    private function getUri()
18
    {
19 5
        $uri = "/rs/postoffice?";
20 5
        if ($this->hasParameter('d2po')) {
21 5
            $uri .= "d2po={$this->getParameter('d2po')}&";
22 5
        }
23
24 5
        if ($this->hasParameter('tonight')) {
25
            $uri .= "tonight={$this->getParameter('tonight')}&";
26
        }
27
28 5
        $uri .= "maximum={$this->getParameter('maximum', 10)}&";
29
30 5
        if ($this->hasParameter('longitude') && $this->hasParameter('latitude')) {
31 3
            $uri .= "longitude={$this->getParameter('longitude')}&";
32 3
            $uri .= "latitude={$this->getParameter('latitude')}&";
33 3
        } else {
34 2
            $uri .= "postalCode={$this->getParameter('postalCode')}&";
35 2
            $uri .= "province={$this->getParameter('province')}&";
36 2
            $uri .= "city={$this->getParameter('city')}&";
37 2
            $uri .= "streetName={$this->getParameter('streetName')}&";
38
        }
39
40 5
        return $uri;
41
    }
42
43
    /**
44
     * @return Request
45
     */
46 5
    protected function buildRequest()
47
    {
48 5
        $request = new Request('GET', $this->getUri());
49 5
        $this->setHeader('Accept', 'application/vnd.cpc.postoffice+xml ');
50 5
        return $request;
51
    }
52
}
53